Home » Modeling » TMF (Xtext) » Duplicate JvmAnnotationTarget '<unnamed>' when using a AbstractModelInferrer
|
Re: Duplicate JvmAnnotationTarget '<unnamed>' when using a AbstractModelInferrer [message #759022 is a reply to message #759018] |
Fri, 25 November 2011 16:03 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
| |
Re: Duplicate JvmAnnotationTarget '&lt;unnamed&gt;' when using a AbstractModelInferr [message #759089 is a reply to message #759047] |
Sat, 26 November 2011 08:50 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
Re: Duplicate JvmAnnotationTarget '&lt;unnamed&gt;' when using a AbstractModelInferr [message #759091 is a reply to message #759089] |
Sat, 26 November 2011 09:21 |
|
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
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
| | | | | | | | |
Goto Forum:
Current Time: Thu Sep 26 08:23:55 GMT 2024
Powered by FUDForum. Page generated in 0.25683 seconds
|