Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343452 - Wrong conditional unit results according to wrong resolved attribute conditions
Summary: Wrong conditional unit results according to wrong resolved attribute conditions
Status: RESOLVED FIXED
Alias: None
Product: EMFT.Henshin
Classification: Modeling
Component: Interpreter (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-20 15:59 EDT by Johannes Tietje CLA
Modified: 2011-04-21 06:17 EDT (History)
0 users

See Also:


Attachments
The minimal example project mentioned in the description. (7.02 KB, application/zip)
2011-04-20 16:00 EDT, Johannes Tietje CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Tietje CLA 2011-04-20 15:59:47 EDT
Build Identifier: 20100917-0705

Hi,

I created a conditional unit which decides by the value of a parameter (set by a previous rule), which of the following rules should be applied. The parameter is either "null" or assigned with an object. The decision, which of the following rules will be applied, is made based on a "empty" rule which has an attribute condition "param == null" to check which value the parameter has.

If I create a second conditional unit with the same rules but the condition "param != null" to check the value, I get on both cases the same result, so I assume, the attribute condition resolver works not right when objects are assigned to parameters.

I could also provide a sample project with a kind of minimal example.

Regards,
Johannes

Reproducible: Always
Comment 1 Johannes Tietje CLA 2011-04-20 16:00:48 EDT
Created attachment 193751 [details]
The minimal example project mentioned in the description.
Comment 2 Enrico Biermann CLA 2011-04-21 06:17:45 EDT
Hello,

the problem is more general, because only attribute conditions that contain parameters initialized by the rules are checked.

To illustrate the problem, assume parameter A which is passed to the rule (for example via parameter mapping), parameter B which is initialized by the rule match and parameter C which is neither passed to the rule nor initialized by the match:
A == null: this condition will be checked before the matching starts if A is set
A == B: this conditions will be checked as soon as the object containing B is matched
B == null: this conditions will be checked as soon as the object containing B is matched
C == null: this conditions is not checked because at the end of matching C remains unknown
1+1 == 2: this condition is never checked because it does not contain parameters

Parameter mappings always initialize their target variable either with the value of their source parameter or "null" if the source parameter is not initialized. If you use only rules you have to explicitly set a parameter even if you want its value to be "null" e.g. ra.setParameterValue("C",null);

Regards,
Enrico