Bug 245619 - Inconsistent implementation of typeconformance for user-defined datatypes
Summary: Inconsistent implementation of typeconformance for user-defined datatypes
Status: CLOSED FIXED
Alias: None
Product: OCL
Classification: Modeling
Component: Core (show other bugs)
Version: 1.1.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 1.2.3   Edit
Assignee: Christian Damus CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2008-08-28 22:29 EDT by Stefan Schulze CLA
Modified: 2011-05-27 02:48 EDT (History)
2 users (show)

See Also:


Attachments
Patch to fix this issue (1.15 KB, patch)
2008-08-28 22:29 EDT, Stefan Schulze CLA
no flags Details | Diff
JUnit-tests to demonstrate this issue (8.05 KB, application/x-zip-compressed)
2008-08-28 22:33 EDT, Stefan Schulze CLA
no flags Details
Combined patch (8.51 KB, patch)
2008-10-10 11:19 EDT, Christian Damus CLA
give.a.damus: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Schulze CLA 2008-08-28 22:29:02 EDT
Created attachment 111259 [details]
Patch to fix this issue

Build ID:  M20080221-1800

Steps To Reproduce:
See attached JUnit-tests

More information:
There are different kinds of typeconformance-checks in the implementation of at least v1.1.x and v1.2.x. This affects the usage of user-defined EDataTypes which are similar to OCLs PrimitiveTypes.
These differences are striking, if you use an EDatatype with name "OwnInteger" and instanceClass java.lang.Integer in the usermodel:

- In the variable-section of let-expressions and the accumulator-definition of iterate-expressions, TypeUtil#typeCompare(..) is used while validation. 
This causes "let i:OwnInteger=5 in i" fail because IntegerLiteral is no valid OwnInteger.

- For looking up an operation which matches the given arguments, UMLReflectionImpl#getOCLTypeFor(...) is used. This causes, that an operation defined as foo(OwnInteger) matches the operation foo(Integer). The call foo(5) matches, too.

- If an operation is called on an user type, it is converted to an OCL standard type before retrieving the available operations (UMLReflectionImpl#getOCLTypeFor(...)
Comment 1 Stefan Schulze CLA 2008-08-28 22:33:25 EDT
Created attachment 111262 [details]
JUnit-tests to demonstrate this issue
Comment 2 Andrew H CLA 2008-10-09 01:35:29 EDT
I would like to add my vote for this bug but I don't get an option to do that. Any  idea why?
Comment 3 Christian Damus CLA 2008-10-09 09:24:33 EDT
(In reply to comment #2)
> I would like to add my vote for this bug but I don't get an option to do that.
> Any  idea why?

Perhaps you have exhausted your vote quota (Bugzilla can limit votes on a per-component and a per-user basis).

I'll have a look at Stefan's patches in this milestone (nicely rounded out with JUnit tests, even, thanks!), and may consider it for the 1.2.3 maintenance, too.  At about 1K, it looks pretty low-risk.
Comment 4 Andrew H CLA 2008-10-09 18:29:51 EDT
Thanks Christan. That would be appreciated.

Incidentally I have only used 2 out 10 votes. The 'vote for this bug' does show up on other bugs (at least ones I raised)
Comment 5 Christian Damus CLA 2008-10-09 18:44:43 EDT
(In reply to comment #4)
> Thanks Christan. That would be appreciated.
> 
> Incidentally I have only used 2 out 10 votes. The 'vote for this bug' does show
> up on other bugs (at least ones I raised)

I checked in the My Foundation portal, and the per-user vote limit for the MDT product is set to 0, which would prevent anybody from voting on any MDT bug.  I have to suppose that this is a mistake, and I'll ask about it on our developer list.
Comment 6 Christian Damus CLA 2008-10-10 09:13:13 EDT
(In reply to comment #4)
> 
> Incidentally I have only used 2 out 10 votes. The 'vote for this bug' does show
> up on other bugs (at least ones I raised)

Voting is now enabled for the MDT product.
Comment 7 Christian Damus CLA 2008-10-10 11:19:40 EDT
Created attachment 114804 [details]
Combined patch

Reworked Stefan's attachments as a single patch, to apply in both the 1.2.3 and 1.3 branches and include attribution of the contribution.
Comment 8 Christian Damus CLA 2008-10-10 11:24:38 EDT
Patch committed to HEAD.  Targeting 1.2.3 release.
Comment 9 Christian Damus CLA 2008-10-10 12:49:48 EDT
Patch committed to 1.2.3 branch.

Thanks, Stefan!
Comment 10 Ed Willink CLA 2011-05-27 02:48:42 EDT
Closing after over 18 months in resolved state.