Skip to main content


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] Sun, 08 April 2012 03:30 Go to next message
tiange zhang is currently offline tiange zhangFriend
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 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
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, 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 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
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
Re: Use xtend2 and xbase-based DSL in GWT application client [message #898008 is a reply to message #839054] Wed, 25 July 2012 15:28 Go to previous message
Dennis Huebner is currently offline Dennis HuebnerFriend
Messages: 257
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 Huebner

Get professional support from the Xtext committers at www.typefox.io
Previous Topic:[Xtend] Shortcut for switching between xtend and java
Next Topic:JVMModelInferrer - suppressing java code generation
Goto Forum:
  


Current Time: Thu Mar 28 10:33:29 GMT 2024

Powered by FUDForum. Page generated in 0.05173 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top