Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Unwanted comments in generated Java Code
Unwanted comments in generated Java Code [message #1262302] Mon, 03 March 2014 13:32 Go to next message
Peter Own is currently offline Peter OwnFriend
Messages: 2
Registered: March 2014
Junior Member
Hi,

I'm using a custom AbtractModelInferrer to generate Java code for my DSL. In a lot of places, I use the newTypeRef method from JvmTypesBuilder to create parameter types, fields types of return types of the classes/methods that I want to generate.

My problem is that half the time, the generated code for the type reference is commented and replaced by a generic Object type. Surprisingly, it only happens when the type reference is a generic type (List<X> or AnyClass<Y>).

As an example, half the time it generates...
public List<ChannelPort> getPort() {


... and the other half:
public /* List<ChannelPort> */Object getPort() {


What surprises me is that if I manually uncomment everything, the generated code compiles. I don't get why Xtext decides to comment this, since everything would work without these comments.

Thanks for your help,

Peter
Re: Unwanted comments in generated Java Code [message #1262400 is a reply to message #1262302] Mon, 03 March 2014 15:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13645
Registered: July 2009
Senior Member
Hi,

how does your inferrer look like? maybe its not always sure if the inferred return type is correct.
have a look at jvmmodelgenerator


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Unwanted comments in generated Java Code [message #1263396 is a reply to message #1262400] Tue, 04 March 2014 12:49 Go to previous message
Peter Own is currently offline Peter OwnFriend
Messages: 2
Registered: March 2014
Junior Member
I wasn't aware of the JvmModelGenerator. I will debug that to see where my problem relies (seems like the hasErrors function on the generated objects returns true, which produces the commented output).

Thanks
Previous Topic:Add UML-Profiles to Xtext-Models
Next Topic:xtext noobie doubt
Goto Forum:
  


Current Time: Sat Oct 31 15:55:36 GMT 2020

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

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

Back to the top