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

Bug 339921

Summary: improve error message resulting from faulty call to error in check method
Product: [Modeling] TMF Reporter: Henrik Lindberg <henrik.lindberg>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: sebastian.zarnekow
Version: 2.0.0Flags: sebastian.zarnekow: juno+
Target Milestone: M7   
Hardware: All   
OS: All   
Whiteboard:

Description Henrik Lindberg CLA 2011-03-14 12:48:59 EDT
When calling error or warning in a @Check method, and passing the wrong literal, the error message could be more helpful.

In my case - the call:

error(
"A selector expression must have at least one right side entry", o,
PPPackage.Literals.BINARY_EXPRESSION__LEFT_EXPRESSION, INSIGNIFICANT_INDEX,
IPPDiagnostics.ISSUE__NULL_EXPRESSION);

Produced the error: EClass 'SelectorExpression' does not expose a feature 'leftExpr'.

I should have used PARAMETERIZED_EXPRESSION__LEFT_EXPRESSION but was fooled by seeing only the name 'leftExpr' (which it indeed does expose).

Suggest that either the full identifier "BINARY_EXPRESSION__LEFT_EXPRESSION" is displayed, or that it also checks if the feature reference is made with a compatible EClass.
Comment 1 Sebastian Zarnekow CLA 2012-04-02 16:24:43 EDT
Easy fix. Thanks for the suggestion.
Comment 2 Karsten Thoms CLA 2017-09-19 16:55:31 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:06:22 EDT
Closing all bugs that were set to RESOLVED before Neon.0