Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XbaseWithAnnotations - Error for parameters
XbaseWithAnnotations - Error for parameters [message #900148] Sat, 04 August 2012 17:14 Go to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Hi,

for a while i am trying to integrate the XAnnotations into my entity model.
I would like to allow the definition of all available jvm annotations.

So i added following to my grammar:

LEntityJVMAnnotations:
{LEntityJVMAnnotations}
'annotations {'
	(annotations+=XAnnotation*)?
'}'



And as a result, i can specify the annotation (even with content assist).
@javax.persistence.Column

But if i try to add parameter to the annotation, i am getting errors.

@javax.persistence.Column(nullable=true)
Error: Couldn't resolve reference to JvmOperation 'nullable'.

So i had a look at xtend, and it works there without any problems.

Then i have added the jars:
- org.eclipse.xtext.xbase.lib
- org.eclipse.xtend.lib
to the classpath, but did not solve the problem.
Still errors.

I think it might be some little setting or something that i missed.

Would be great if someone of you has a hint how to solve the problem.


BTW: The contentassist for annotation parameters shows up all methods that have been prepared by the JVMModelInferrer by me.

Thanks in advance,
any hints very welcome!

Best Florian
Re: XbaseWithAnnotations - Error for parameters [message #900524 is a reply to message #900148] Tue, 07 August 2012 11:46 Go to previous messageGo to next message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

I did further tests but could not find the problem. The project is setup properly, since xtend classes can resolve all required stuff.

Adding that annotation works really fine...
@javax.persistence.Entity()
cachable embeddable entity Library {



But if I am adding annotations with parameters, i am getting errors.


@javax.persistence.Access(value=javax::persistence::AccessType::FIELD)
cachable embeddable entity Library {

causes "The annotation must define the attribute 'value'."


In modelInferrer i am doing
jvmTypesBuilder#translateAnnotationsTo(xAnnotation, jvmType)


So i think everything seems to be fine.


Additionally i browsed the Xtend implementation but did not find anything that was written specially to support XAnnotations. So i guess there should be no additional code to enable them.


Any suggestions / ideas highly welcome...

Best,
Florian
Re: XbaseWithAnnotations - Error for parameters [message #900853 is a reply to message #900524] Wed, 08 August 2012 17:45 Go to previous message
Florian Pirchner is currently offline Florian PirchnerFriend
Messages: 94
Registered: July 2009
Member

Sometimes solutions are sooo simple.

Just extended the wrong ScopeProvider...

Was
public class EntityScopeProvider extends XbaseScopeProvider


Should be
public class EntityScopeProvider extends XbaseWithAnnotationsScopeProvider 


Now everything works fine!
Previous Topic:Triggering generator using context menu in xtext
Next Topic:test error with xtend
Goto Forum:
  


Current Time: Fri Apr 26 00:24:47 GMT 2024

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

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

Back to the top