Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [xcore][xtend](Compliation problem on Xtend class inheriting from Xcore generated ItemProvider class)
[xcore][xtend] [message #1792269] Fri, 13 July 2018 17:39 Go to next message
Maged Elaasar is currently offline Maged ElaasarFriend
Messages: 21
Registered: September 2013
Junior Member
Hi all,

I am running into a bizarre problem that I would appreciate help with. I created a simpler example that I can describe here (sources attached).

I have a simple Xcore model (test.xcore) that generates code in (test and test.edit) plugins (both in "src-gen" folder). I needed to do some changes to the generated ItemProviders in the test.edit plugin, but instead of hijacking the generated ItemProvider classes (e.g., Class1ItemProvider) with generated NOT annotation, I want to create subclasses of the ItemProviders (e.g., Class1ItemProviderEx) in a "src" folder. I decided to write such subclasses in Xtend, so I added the xbase lib to the edit plugin's dependencies.

here is how my Class1ItemProviderEx.xtend look like:

package test.provider
import org.eclipse.emf.common.notify.AdapterFactory
class Class1ItemProviderEx extends Class1ItemProvider {
new(AdapterFactory adapterFactory) {

The problem is that the Xtend class is confused about the constructor and methods inherited from the Xcore-generated ItemProvider class. For example, I get the following compliation error:

"No default constructor in super type Class1ItemProvider. Another constructor must be invoked explicitly. Class1ItemProviderEx.xtend /test.edit/src/test/provider."

One thing I also noticed is that when I navigate from the ClassItemProvider in the .Xtend class to its type definition (by hovering and clicking the hyperlink), it takes me to the xcore file (test.xcore) as opposed to the Java Class (Class1ItemProvider). Not sure if this is a clue or not. Also, when I uninstall the Xcore plugins from the dev IDE, the problem disappears. So, it looks to me that it's an interaction between Xcore and Xtend.

I would appreciate your input on this.

  • Attachment:
    (Size: 43.01KB, Downloaded 17 times)
Re: [xcore][xtend] [message #1792283 is a reply to message #1792269] Sat, 14 July 2018 05:16 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 30353
Registered: July 2009
Senior Member
Yes, this is easy to explain. While we infer the complete JVM Type representation for the model classes, we do not infer the complete JVM Type representation for the item provider classes, only the stub for the class itself, without super types, fields, constructors, or methods.

For your specific purpose we'd need minimally to infer the super types and the constructor. Of you could instead write your extension in Java, which avoids Xtend's the need for the inferred JVM Type representation to be complete.

Previous Topic:Xcore 2.14 vs Workspace vs. standalone
Next Topic:Extending Ecore models
Goto Forum:

Current Time: Wed Aug 21 00:36:22 GMT 2019

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

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

Back to the top