Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to specify a super class in JvmInferrer(I want to generate a class with a super class, how do I do this with JvmModelInferrer?)
How to specify a super class in JvmInferrer [message #1739902] Fri, 05 August 2016 14:25 Go to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I want to generate a class with a super class, how do I do this with JvmModelInferrer?
The "superTypes +=" generates an "implements" clause but I need an "extends" clause.
Which variable I can use for that?
Re: How to specify a super class in JvmInferrer [message #1739904 is a reply to message #1739902] Fri, 05 August 2016 14:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
supertype += "m.Superclass".typeRef() does not work?
i which inferrer phase do you do that?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to specify a super class in JvmInferrer [message #1739908 is a reply to message #1739904] Fri, 05 August 2016 15:33 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Fri, 05 August 2016 10:41
supertype += "m.Superclass".typeRef() does not work?
i which inferrer phase do you do that?

1)
supertype += ...
Is unknown.
and
superTypes += ...
Does produce an "implements" clause.
2)
In the "isPreIndexingPhase = false" phase.
Re: How to specify a super class in JvmInferrer [message #1739912 is a reply to message #1739908] Fri, 05 August 2016 16:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
i cannot reproduce this

domainmodelexample:

class DomainmodelJvmModelInferrer extends AbstractModelInferrer {
	
	@Inject extension JvmTypesBuilder
	@Inject extension IQualifiedNameProvider

	def dispatch infer(Entity entity, extension IJvmDeclaredTypeAcceptor acceptor, boolean prelinkingPhase) {
		accept(entity.toClass( entity.fullyQualifiedName )) [
			documentation = entity.documentation
			superTypes += "demo.AbstractEntity".typeRef
		]
	}
	
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to specify a super class in JvmInferrer [message #1739920 is a reply to message #1739912] Fri, 05 August 2016 17:05 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Fri, 05 August 2016 12:04
i cannot reproduce this


And what is the resulting class code ?
Re: How to specify a super class in JvmInferrer [message #1739921 is a reply to message #1739920] Fri, 05 August 2016 17:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
import demo.AbstractEntity;

@SuppressWarnings("all")
public class Demo extends AbstractEntity {
}


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to specify a super class in JvmInferrer [message #1739923 is a reply to message #1739920] Fri, 05 August 2016 17:12 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Olaf Bigalk wrote on Fri, 05 August 2016 13:05
Christian Dietrich wrote on Fri, 05 August 2016 12:04
i cannot reproduce this


And what is the resulting class code ?


Sorry, I tried again and now it works. Don't know why.

Thank you for your patiencs.
Re: How to specify a super class in JvmInferrer [message #1739929 is a reply to message #1739923] Fri, 05 August 2016 17:58 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
I discoverd that the "superTypes +=" does not work correctly if the referenced type could not be found in the generators context.
May this be a bug ?
Re: How to specify a super class in JvmInferrer [message #1739932 is a reply to message #1739929] Fri, 05 August 2016 18:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
Olaf Bigalk <forums-noreply@xxxxxxxx> wrote:
> I discoverd that the "superTypes +=" does not work correctly if the
> referenced type could not be found in the generators context.
> May this be a bug ?
>
>

What do you mean by generators context


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to specify a super class in JvmInferrer [message #1740003 is a reply to message #1739932] Sun, 07 August 2016 19:20 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Fri, 05 August 2016 14:02
Olaf Bigalk <forums-noreply@xxxxxxxx> wrote:
> I discoverd that the "superTypes +=" does not work correctly if the
> referenced type could not be found in the generators context.
> May this be a bug ?
>
>

What do you mean by generators context

The context in which the generator runs including the generated classes.
Re: How to specify a super class in JvmInferrer [message #1740006 is a reply to message #1740003] Mon, 08 August 2016 03:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
well this would mean you reference a class that does not exist right?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to specify a super class in JvmInferrer [message #1740041 is a reply to message #1740003] Mon, 08 August 2016 03:11 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
Well Thats a Feature

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: How to specify a super class in JvmInferrer [message #1740157 is a reply to message #1740006] Tue, 09 August 2016 21:18 Go to previous messageGo to next message
Olaf Bigalk is currently offline Olaf BigalkFriend
Messages: 155
Registered: July 2009
Location: Berlin
Senior Member
Christian Dietrich wrote on Sun, 07 August 2016 23:43
well this would mean you reference a class that does not exist right?

Yes, that means that non existent classes are considered to be interfaces - right ?
Re: How to specify a super class in JvmInferrer [message #1740171 is a reply to message #1740157] Wed, 10 August 2016 05:06 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14699
Registered: July 2009
Senior Member
Yes

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:rootPath, alternative folder layouts and maven build
Next Topic:How to generate a method with a throws clause
Goto Forum:
  


Current Time: Sat Jul 27 10:30:43 GMT 2024

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

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

Back to the top