Community
Participate
Working Groups
When using NamesAreUniqueValidator in a DSL in conjunction with a AbstractModelInferrer, upon saving an input file of the DSL you get the following errors in the Problems view Duplicate JvmAnnotationTarget '<unnamed>' Christian says that "The Problem is that the inferred class and its constructor have the same name - both are annotation targets => the check will fail.", http://www.eclipse.org/forums/index.php/mv/msg/262760/759047/#msg_759047 Binding a NamesAreUniqueValidatorHelper will not help: either you deselect unique name checks on JvmAnnotationTargets (losing the checks on jvm related names, e.g., in the domain model example, that all entities have unique names) or you are not able to use the model inferrer (due to above errors). Steps to reproduce: 1. materialize the domainmodel example 2. change the validator from public class DomainmodelJavaValidator extends XbaseJavaValidator { to public class DomainmodelJavaValidator extends AbstractDomainmodelJavaValidator { (since AbstractDomainmodelJavaValidator has a composed validator NamesAreUniqueValidator, while still extending XbaseJavaValidator) 3. run another eclipse instance, create a new project and create a .dmodel file, with an entity and save it
Created attachment 207582 [details] mylyn/context/zip
The NamesAreUniqueValidator is only a simple approach to a generalized validation for unique names. It fails for more complicates cases like overloaded methods or annotation targets. I'm afraid you'll have to implement the name checking by yourself if you use Xbase.
well at least if I use the model inferrer :) I seem to be able to use it together with xbase if I don't use the model inferrer; however, I see your point, for the moment I'll do manual generation with xtend2 (without using the model inferrer). I guess the documentation should state this, though :)
Closing this, since it works as designed (see comment #2).