Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 364910

Summary: NamesAreUniqueValidator does not coexist with AbstractModelInferrer
Product: [Modeling] TMF Reporter: Lorenzo Bettini <lorenzo.bettini>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: btickets, mail, sebastian.zarnekow, sven.efftinge
Version: 2.1.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip none

Description Lorenzo Bettini CLA 2011-11-27 10:25:41 EST
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
Comment 1 Lorenzo Bettini CLA 2011-11-27 10:28:13 EST
Created attachment 207582 [details]
mylyn/context/zip
Comment 2 Sebastian Zarnekow CLA 2011-11-27 10:37:33 EST
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.
Comment 3 Lorenzo Bettini CLA 2011-11-27 10:48:48 EST
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 :)
Comment 4 Sven Efftinge CLA 2013-08-15 02:58:10 EDT
Closing this, since it works as designed (see comment #2).