Bug 484857 - [AQL] False positive of validation in precondition of Selection Wizard and Pane Based Selection Wizard
Summary: [AQL] False positive of validation in precondition of Selection Wizard and Pa...
Status: NEW
Alias: None
Product: Sirius
Classification: Modeling
Component: Core (show other bugs)
Version: 3.1.0   Edit
Hardware: PC Windows NT
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on: 486856
Blocks:
  Show dependency tree
 
Reported: 2015-12-23 09:16 EST by Etienne Juliot CLA
Modified: 2016-05-31 08:43 EDT (History)
3 users (show)

See Also:


Attachments
basicfamily.odesign with a selectionwizard having a false positive warning (5.46 KB, application/octet-stream)
2016-01-29 11:37 EST, Cedric Brun CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Etienne Juliot CLA 2015-12-23 09:16:48 EST
Steps to reproduce :
- with basicfamily, add a Selection Wizard tool
- in precondition, add "aql:container.oclIsTypeOf(basicfamily::Family)"

Completion and runtime works. But validation creates a "Always false" error : "

Description	Resource	Path	Location	Type
Always false:
Nothing inferred when self (EClassifier=EObject) is type of EClassifierLiteral=Talk	conference.odesign	/fr.obeo.conference.design/description	Unknown	EMF Problem
"
Comment 1 Esteban DUGUEPEROUX CLA 2015-12-28 10:04:57 EST
I confirm the bug, I have had the same through Bug 484217
Comment 2 Cedric Brun CLA 2016-01-29 10:57:54 EST
Etienne can you tell us if you did reference the "basicfamily" metamodel in your DiagramDescription or not ?
Comment 3 Cedric Brun CLA 2016-01-29 11:36:10 EST
(In reply to Etienne Juliot from comment #0)
> Steps to reproduce :
> - with basicfamily, add a Selection Wizard tool
> - in precondition, add "aql:container.oclIsTypeOf(basicfamily::Family)"
> 
> Completion and runtime works. But validation creates a "Always false" error
> : "
> 
> Description	Resource	Path	Location	Type
> Always false:
> Nothing inferred when self (EClassifier=EObject) is type of
> EClassifierLiteral=Talk	conference.odesign
> /fr.obeo.conference.design/description	Unknown	EMF Problem
> "

The report is misleading as its mixing  the basicfamily & conference examples but it can be reproduced with basicfamily (I'm attaching the model).

With the recent changes in AQL and Sirius it is now a warning (and not an "error".)

if oclIsKindOf(basicfamily::Family) is used instead of oclIsTypeOf() then everything is fine. Looks like AQL's type inference is failing in the case of oclIsTypeOf()
Comment 4 Cedric Brun CLA 2016-01-29 11:37:19 EST
Created attachment 259452 [details]
basicfamily.odesign with a selectionwizard having a false positive warning
Comment 5 Yvan Lussaud CLA 2016-02-02 05:47:21 EST
It's not quiet clear to me which level you are using to report type inference status. But I will suggest that you keep INFO level as in AQL...
Comment 6 Cedric Brun CLA 2016-02-02 05:52:59 EST

(In reply to Yvan Lussaud from comment #5)
> It's not quiet clear to me which level you are using to report type
> inference status. But I will suggest that you keep INFO level as in AQL...

INFO is ok on the AQL side, Sirius only knows about warning and errors so an "INFO" will be changed into a WARNING (see IInterpreterStatus and AQLSiriusInterpreter.analyzeExpression(IInterpreterContext, String) )
which is... ok I guess. But it used to be transformed as ERRORS (See Bug 485610)
Comment 7 Etienne Juliot CLA 2016-02-02 07:55:10 EST
Whatever the level you choose, the message should be more explicit. "Always false" doesn't really help. 
It would better if you can provide a message like "Ambiguous expression. Use oclIsKindOf() instead of oclIsTypeOf()."

But at the end, the real fix should support oclIsTypeOf with the good inference behavior, and no warning at all.
Comment 8 Cedric Brun CLA 2016-02-02 09:04:43 EST
(In reply to Etienne Juliot from comment #7)
> Whatever the level you choose, the message should be more explicit. "Always
> false" doesn't really help. 
> It would better if you can provide a message like "Ambiguous expression. Use
> oclIsKindOf() instead of oclIsTypeOf()."

I don't get it. There is no ambiguity, the warning is "Hey, your expression will *always* be false, are you sure that's what you meant ?" 
Let's say a variable called "element" can only be a UML::Class or a UML::Attribute and you write "element.oclIsTypeOf(uml::Parameter)"
This expression will always be false.

AQL can't say "use oclIsKindOf instead" as these are two very different things. oclIsKindOf is true of the instance is compatible with the given type, even for subclasses. oclIsTypeOf is only true if this is the exact type and not a subclass. 

> But at the end, the real fix should support oclIsTypeOf with the good
> inference behavior, and no warning at all.

Indeed, in this case AQL this is bug, the bug does not exists with oclIsKindOf as its has been way more used and tested  already compared to oclIsTypeOf which have very litle use.

Would "The expression XXXX will always be true (or false)" be an improvement in your opinion ?
Comment 9 Yvan Lussaud CLA 2016-05-31 08:43:23 EDT
This bug should be fixed with this review:
https://git.eclipse.org/r/#/c/65487/