Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Xcore] produces non-compiling Java code when using closures
[Xcore] produces non-compiling Java code when using closures [message #965783] Wed, 31 October 2012 09:58 Go to next message
Nicolas Cabanis is currently offline Nicolas Cabanis
Messages: 12
Registered: July 2009
Junior Member
Hello,

I am referring to http://wiki.eclipse.org/Xcore # Specifying an Operation.

Assume the following method is added to the Library class:
   op Book[] findBooksByAuthor (Author author) {
      return authors.filter [it == author].toList
   }


produces two problems:
1.) an EList is expected instead of List
2.) the generated code contains an anonymous inner class and the "author" param is not final

Regards,
Nicolas
Re: [Xcore] produces non-compiling Java code when using closures [message #965809 is a reply to message #965783] Wed, 31 October 2012 10:14 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 24545
Registered: July 2009
Senior Member
Nicolas,

All the parameters should be final in the recent nightly builds. These
builds also include support for extension methods, so you can write toEList.


On 31/10/2012 2:58 PM, Nicolas Cabanis wrote:
> Hello,
>
> I am referring to http://wiki.eclipse.org/Xcore # Specifying an
> Operation.
>
> Assume the following method is added to the Library class:
>
> op Book[] findBooksByAuthor (Author author) {
> return authors.filter [it == author].toList
> }
>
>
> produces two problems:
> 1.) an EList is expected instead of List
> 2.) the generated code contains an anonymous inner class and the
> "author" param is not final
>
> Regards,
> Nicolas
Previous Topic:[TEXO] ModelXMLLoader mapping
Next Topic:Get the selected menu item
Goto Forum:
  


Current Time: Wed May 22 01:36:15 EDT 2013

Powered by FUDForum. Page generated in 0.03242 seconds