Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Use xtend2 and xbase-based DSL in GWT application client
Use xtend2 and xbase-based DSL in GWT application client [message #839054] Sat, 07 April 2012 23:30 Go to next message
tiange zhang is currently offline tiange zhang
Messages: 16
Registered: February 2011
Location: Shanghai, China
Junior Member
Hi,

I want to use xtend2 in GWT application client. The first step is to compile xbase.lib with gwt compiler(I use org.eclipse.xtext.xbase.lib_2.2.0.v201112030424.jar). Fortunately Xbase.lib depends heavily on guava and most of guava classes are GWT compatible. But I found xbase.lib still references to some GWT incompatible classes/methods:

1. Iterables.filter(Iterable<?>, Class<?>) in guava is marked as @GwtIncompatible, so any methods call to this method should be removed. These methods are:
IterableExtensions::filter(Iterable<?> unfiltered, Class<T> type)
IteratorExtensions:: filter(Iterator<?> unfiltered, Class<T> type)

2. Conversions.java contains a lot of Gwt incompatible references, following is the compile errors by GWT compiler:
[INFO]  [ERROR] Errors in '... /src/main/java/org/eclipse/xtext/xbase/lib/Conversions.java'
[INFO]          [ERROR] Line 92: The method toArray(Iterable<?>) in the type Iterables is not applicable for the arguments (Iterable, Class<capture#9-of ?>)
[INFO]          [ERROR] Line 127: The method isAssignableFrom(Class<capture#18-of ?>) is undefined for the type Class<capture#17-of ?>
[INFO]          [ERROR] Line 130: The method getCanonicalName() is undefined for the type Class<capture#19-of ?>
[INFO]          [ERROR] Line 130: The method getCanonicalName() is undefined for the type Class<capture#20-of ?>
[INFO]          [ERROR] Line 201: modCount cannot be resolved
[INFO]          [ERROR] Line 218: Cannot invoke clone() on the array type T[]
[INFO]          [ERROR] Line 229: modCount cannot be resolved
[INFO]          [ERROR] Line 266: No source code is available for type java.lang.reflect.Array; did you forget to inherit a required module?
[INFO]          [ERROR] Line 304: modCount cannot be resolved
[INFO]          [ERROR] Line 329: modCount cannot be resolved

So Conversions should be entirely removed

After those methods/classes that can't be compiled are removed, I wrote a very simple test case, it seems xtend2 work well in GWT. But if I use Iterables.filter(Iterable,Class), xtends will pass but generated java source contains compile error, becase filter(Iterable,Class) is removed from local version of IterableExtensions but still exist in reference Xtend Library .

My questions:
1.Is it possible to show the errors in xtend2 editor? Perhaps need a different version of xbase.lib?
2.Conversions.java is removed, so what kind of xtend2 features is moved too?


Thanks

Re: Use xtend2 and xbase-based DSL in GWT application client [message #840532 is a reply to message #839054] Tue, 10 April 2012 03:50 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten Thoms
Messages: 353
Registered: July 2009
Location: Dortmund
Senior Member

Hi,

this is not necessary. You could provide your own GWT compatible versions of the libraries. There is no hard dependency on the bundles, they are usually used with Import-Package. So copy the library as a new plugin, remove everything what you don't want, and make sure that you use your library.

Regards,
~Karsten


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @kthoms
Blog : www.karsten-thoms.de
Re: Use xtend2 and xbase-based DSL in GWT application client [message #840631 is a reply to message #839054] Tue, 10 April 2012 06:08 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven Efftinge
Messages: 1761
Registered: July 2009
Senior Member
We want to provide a gwt-compatible jar in the next release.

Please attach any related findings to this bugzilla :
https://bugs.eclipse.org/bugs/show_bug.cgi?id=375808

Am 4/8/12 5:30 AM, schrieb tiange zhang:
> Hi,
>
> I want to use xtend2 in GWT application client. The first step is to
> compile xbase.lib with gwt compiler(I use
> org.eclipse.xtext.xbase.lib_2.2.0.v201112030424.jar). Fortunately
> Xbase.lib depends heavily on guava and most of guava classes are GWT
> compatible. But I found xbase.lib still references to some GWT
> incompatible classes/methods:
>
> 1. Iterables.filter(Iterable<?>, Class<?>) in guava is marked as
> @GwtIncompatible, so any methods call to this method should be removed.
> These methods are: IterableExtensions::filter(Iterable<?> unfiltered,
> Class<T> type)
> IteratorExtensions:: filter(Iterator<?> unfiltered, Class<T> type)
>
> 2. Conversions.java contains a lot of Gwt incompatible references,
> following is the compile errors by GWT compiler:
>
> [INFO] [ERROR] Errors in '...
> /src/main/java/org/eclipse/xtext/xbase/lib/Conversions.java'
> [INFO] [ERROR] Line 92: The method toArray(Iterable<?>) in the
> type Iterables is not applicable for the arguments (Iterable,
> Class<capture#9-of ?>)
> [INFO] [ERROR] Line 127: The method
> isAssignableFrom(Class<capture#18-of ?>) is undefined for the type
> Class<capture#17-of ?>
> [INFO] [ERROR] Line 130: The method getCanonicalName() is
> undefined for the type Class<capture#19-of ?>
> [INFO] [ERROR] Line 130: The method getCanonicalName() is
> undefined for the type Class<capture#20-of ?>
> [INFO] [ERROR] Line 201: modCount cannot be resolved
> [INFO] [ERROR] Line 218: Cannot invoke clone() on the array
> type T[]
> [INFO] [ERROR] Line 229: modCount cannot be resolved
> [INFO] [ERROR] Line 266: No source code is available for type
> java.lang.reflect.Array; did you forget to inherit a required module?
> [INFO] [ERROR] Line 304: modCount cannot be resolved
> [INFO] [ERROR] Line 329: modCount cannot be resolved
>
> So Conversions should be entirely removed
>
> After those methods/classes that can't be compiled are removed, I wrote
> a very simple test case, it seems xtend2 work well in GWT. But if I use
> Iterables.filter(Iterable,Class), xtends will pass but generated java
> source contains compile error, becase filter(Iterable,Class) is removed
> from local version of IterableExtensions but still exist in reference
> Xtend Library .
>
> My questions:
> 1.Is it possible to show the errors in xtend2 editor? Perhaps need a
> different version of xbase.lib?
> 2.Conversions.java is removed, so what kind of xtend2 features is moved
> too?
>
>
> Thanks
>
>


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de


--
Need professional support on Xtext or Xtend?
Mail to: xtext (at) itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: Use xtend2 and xbase-based DSL in GWT application client [message #898008 is a reply to message #839054] Wed, 25 July 2012 11:28 Go to previous message
Dennis Huebner is currently offline Dennis Huebner
Messages: 204
Registered: July 2009
Senior Member

Hi tiange zhang,
you can try the first draft of gwt compatible libraries here:
http://www.eclipse.org/modeling/tmf/downloads/?showAll=1&hlbuild=N201207251051&project=xtext#N201207251051

Please let me know if something is missing or just wrong.



+Dennis Hübner

--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:[Xtend] Shortcut for switching between xtend and java
Next Topic:JVMModelInferrer - suppressing java code generation
Goto Forum:
  


Current Time: Sat Aug 30 08:30:38 EDT 2014

Powered by FUDForum. Page generated in 0.03220 seconds