Use xtend2 and xbase-based DSL in GWT application client [message #839054] |
Sun, 08 April 2012 03:30 |
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 07:50 |
|
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, EMF, Eclipse IDE?
Go to: http://devhub.karakun.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 10:08 |
Sven Efftinge Messages: 1823 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
|
|
|
|
Powered by
FUDForum. Page generated in 0.05173 seconds