| Summary: | [Validation] Marker/Annotation creation does not take URI of error source into account | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Alexander Nittka <alex> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sebastian.zarnekow |
| Version: | 2.0.0 | Flags: | sven.efftinge:
kepler+
|
| Target Milestone: | M4 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
I think we should throw a runtime exception (IllegalArgument) if one tries to create issues for the wrong resource. pushed to master Requested via bug 522520. -M. |
If you create an error/warning for an object X (error source) not located in the current resource (of the context object O), the marker is created for the resource of O rather than that of X. The node model information of X is used. Example Grammar: Model: greetings+=Greeting* ('ref' ref=[Greeting])?; Greeting: 'Hello' name=ID '!'; Example Validation: @Check public void checkGreetingStartsWithCapital(Model model) { if(model.getRef()!=null){ if (!Character.isUpperCase(model.getRef().getName().charAt(0))) { error("Name must start with a capital", model.getRef(),MyDslPackage.Literals.GREETING__NAME,0); } } } Sample file1: Hello sven! Hello Sebastian! Sample file2: /*comment*/ ref sven In this (stupid) example, the reference (file2) checks whether some property of the referenced object is satisfied and tries to mark the error in the target (file1). However, the marker/annotation is created in file2. It seems that the URI of the error source object is not taken into account. This issue exists for Xtext 1.x as well.