Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Duplicate JvmAnnotationTarget '<unnamed>' when using a AbstractModelInferrer
Duplicate JvmAnnotationTarget '<unnamed>' when using a AbstractModelInferrer [message #759018] Fri, 25 November 2011 15:30 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I just started using AbstractModelInferrer (actually
MyDslJvmModelInferrer), with a very basic infer method:

def dispatch void infer(Rule rule, IAcceptor<JvmDeclaredType> acceptor,
boolean isPrelinkingPhase) {
acceptor.accept(
rule.toClass(rule.fullyQualifiedName) [
documentation = rule.documentation

]
)
}

the problem is that when I run the second eclipse instance I get errors
of this shape in the Problem view (and attached to the file, none in the
editor):

Duplicate JvmAnnotationTarget '<unnamed>'

I'm trying it with a dsl file with only one Rule element so there's no
other element with that name...

the problems goes away if I comment out from my mwe2 file

composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"

any clue please?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Duplicate JvmAnnotationTarget '&lt;unnamed&gt;' when using a AbstractModelInferrer [message #759022 is a reply to message #759018] Fri, 25 November 2011 16:03 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/25/2011 04:30 PM, Lorenzo Bettini wrote:
> Hi
>
> I just started using AbstractModelInferrer (actually
> MyDslJvmModelInferrer), with a very basic infer method:
>
> def dispatch void infer(Rule rule, IAcceptor<JvmDeclaredType> acceptor,
> boolean isPrelinkingPhase) {
> acceptor.accept(
> rule.toClass(rule.fullyQualifiedName) [
> documentation = rule.documentation
>
> ]
> )
> }
>
> the problem is that when I run the second eclipse instance I get errors
> of this shape in the Problem view (and attached to the file, none in the
> editor):
>
> Duplicate JvmAnnotationTarget '<unnamed>'
>
> I'm trying it with a dsl file with only one Rule element so there's no
> other element with that name...
>
> the problems goes away if I comment out from my mwe2 file
>
> composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
>
> any clue please?
>
> thanks in advance
> Lorenzo
>

By the way, this is reproducible by implementing "The Five Simple Steps
to your JVM Language" and then enabling in the workflow the

composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Duplicate JvmAnnotationTarget '&lt;unnamed&gt;' when using a AbstractModelInferrer [message #759047 is a reply to message #759022] Fri, 25 November 2011 20:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
The Problem is that the inferred class and its constructor have the same name - both are annotation targets
=> the check will fail. id try to bind a customized NamesAreUniqueValidationHelper

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Duplicate JvmAnnotationTarget '&amp;lt;unnamed&amp;gt;' when using a AbstractModelInferr [message #759089 is a reply to message #759047] Sat, 26 November 2011 08:50 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/25/2011 09:29 PM, Christian Dietrich wrote:
> The Problem is that the inferred class and its constructor have the same
> name - both are annotation targets
> => the check will fail. id try to bind a customized
> NamesAreUniqueValidationHelper

but then why does it say <unnamed>?

you mean then to have a NamesAreUniqueValidationHelper which simply
checks the class of the object to check? For instance this method?

protected void checkDescriptionForDuplicatedName(
IEObjectDescription description,
Map<EClass, Map<QualifiedName, IEObjectDescription>> clusterTypeToName,
ValidationMessageAcceptor acceptor)

cheers
Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Duplicate JvmAnnotationTarget '&amp;lt;unnamed&amp;gt;' when using a AbstractModelInferr [message #759091 is a reply to message #759089] Sat, 26 November 2011 09:21 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/26/2011 09:50 AM, Lorenzo Bettini wrote:
> On 11/25/2011 09:29 PM, Christian Dietrich wrote:
>> The Problem is that the inferred class and its constructor have the same
>> name - both are annotation targets
>> => the check will fail. id try to bind a customized
>> NamesAreUniqueValidationHelper
>
> but then why does it say <unnamed>?
>
> you mean then to have a NamesAreUniqueValidationHelper which simply
> checks the class of the object to check? For instance this method?
>
> protected void checkDescriptionForDuplicatedName(
> IEObjectDescription description,
> Map<EClass, Map<QualifiedName, IEObjectDescription>> clusterTypeToName,
> ValidationMessageAcceptor acceptor)
>

so I tried overriding getClusterTypes() by inserting only the EClasses
of my DSL package, but the problem with JvmAnnotationTarget shows up
again...

thus, I tried to override this method as follows:

protected void checkDescriptionForDuplicatedName(
IEObjectDescription description,
Map<EClass, Map<QualifiedName, IEObjectDescription>> clusterTypeToName,
ValidationMessageAcceptor acceptor) {
//super.checkDescriptionForDuplicatedName(description,
clusterTypeToName, acceptor);
EObject object = description.getEObjectOrProxy();
EClass eClass = object.eClass();
if (TypesPackage.Literals.JVM_ANNOTATION_TARGET.equals(eClass))
return;
}

this makes the Duplicate error go away, but now I miss all the other
checks (for instance two jvm parameters with the same name is not
detected as an error)...

now I'm kind of lost...

cheers
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Duplicate JvmAnnotationTarget '&amp;lt;unnamed&amp;gt;' when using a AbstractModelInferr [message #759093 is a reply to message #759091] Sat, 26 November 2011 09:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i actually meant something like

@Override
	protected ImmutableSet<EClass> getClusterTypes() {
		return ImmutableSet.of(DomainmodelPackage.Literals.ENTITY, DomainmodelPackage.Literals.OPERATION, DomainmodelPackage.Literals.PROPERTY, TypesPackage.Literals.JVM_GENERIC_TYPE);
	}


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Duplicate JvmAnnotationTarget '&amp;lt;unnamed&amp;gt;' when using a AbstractModelInferr [message #759094 is a reply to message #759093] Sat, 26 November 2011 10:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

sorry here the right version: i actually meant something like

@Override
	protected ImmutableSet<EClass> getClusterTypes() {
		return ImmutableSet.of(DomainmodelPackage.Literals.ENTITY, DomainmodelPackage.Literals.OPERATION, DomainmodelPackage.Literals.PROPERTY);
	}


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Duplicate JvmAnnotationTarget '&amp;lt;unnamed&amp;gt;' when using a AbstractModelInferr [message #759095 is a reply to message #759094] Sat, 26 November 2011 10:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
P.S: you have to fix this one too

protected EClass getAssociatedClusterType(EClass eClass) {
		if (clusterTypes.contains(eClass))
			return eClass;
		EList<EClass> superTypes = eClass.getESuperTypes();
		if (superTypes.isEmpty())
			return eClass;
		return getAssociatedClusterType(superTypes.get(0));
	}



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 26 November 2011 10:24]

Report message to a moderator

Re: Duplicate JvmAnnotationTarget '&amp;amp;lt;unnamed&amp;amp;gt;' when using a AbstractMod [message #759103 is a reply to message #759095] Sat, 26 November 2011 11:37 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/26/2011 11:24 AM, Christian Dietrich wrote:
> P.S: you have to fix this one too protected EClass
> getAssociatedClusterType(EClass eClass) {
> if (clusterTypes.contains(eClass))
> return eClass;
> EList<EClass> superTypes = eClass.getESuperTypes();
> if (superTypes.isEmpty())
> return eClass;
> return getAssociatedClusterType(superTypes.get(0));
> }
>
>

however, even if I do this I'll lose name checks for other xbase
elements (see my last post before this one)... I guess Names unique
checks cannot coexist at the moment with model inferrer?

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Duplicate JvmAnnotationTarget '&amp;amp;lt;unnamed&amp;amp;gt;' when using a AbstractMod [message #759104 is a reply to message #759103] Sat, 26 November 2011 11:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
at least with the current implementation

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Duplicate JvmAnnotationTarget '&amp;amp;amp;lt;unnamed&amp;amp;amp;gt;' when using a Abs [message #759131 is a reply to message #759104] Sat, 26 November 2011 16:23 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/26/2011 12:50 PM, Christian Dietrich wrote:
> at least with the current implementation

OK; do you think it's worth to file a bug?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: Duplicate JvmAnnotationTarget '&amp;amp;amp;lt;unnamed&amp;amp;amp;gt;' when using a Abs [message #759132 is a reply to message #759131] Sat, 26 November 2011 16:26 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
feel free to do so

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Duplicate JvmAnnotationTarget '&amp;amp;amp;amp;lt;unnamed&amp;amp;amp;amp;gt;' when usi [message #759200 is a reply to message #759132] Sun, 27 November 2011 15:26 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 11/26/2011 05:26 PM, Christian Dietrich wrote:
> feel free to do so

done

https://bugs.eclipse.org/bugs/show_bug.cgi?id=364910

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Can't get All sub-entities defined in different files(Xtext2.1.1)
Next Topic:[Xtend 2] == != ==
Goto Forum:
  


Current Time: Fri Apr 19 12:34:09 GMT 2024

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

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

Back to the top