Bug 351317 - Error in (redundant) cast of anchored type
Summary: Error in (redundant) cast of anchored type
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTJ (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 2.0.1   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard: Also released in 2.1 M1
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-06 08:29 EDT by Andreas Mertgen CLA
Modified: 2012-05-23 17:22 EDT (History)
1 user (show)

See Also:
stephan.herrmann: iplog+


Attachments
test & fix (2.22 KB, patch)
2011-07-13 14:47 EDT, Stephan Herrmann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Mertgen CLA 2011-07-06 08:29:27 EDT
Here is an example of a simple team class: 

public team class T {	
  public class R playedBy A {}
}

A cast like the following (although it is needless here) will result in errors "Cannot cast from R<@t> to R<@t> []" and "Type mismatch: cannot convert from R<@t> [] to R<@t>".

A a = new A();
final T t = new T();
R<@t> r = (R<@t>) t.getRole(a, R<@t>.class);

I would expect this cast to be correct.
Comment 1 Stephan Herrmann CLA 2011-07-06 12:20:03 EDT
Strange indeed. Something's broken with the array dimensions.
I'll take a look.
Comment 2 Stephan Herrmann CLA 2011-07-13 14:47:15 EDT
Created attachment 199611 [details]
test & fix

The role class literal was not correctly parsed: some source positions
were not consumed from the intStack and were subsequently interpreted
as array dimensions leading to random results.

Fixed by the attached patch.
Comment 3 Stephan Herrmann CLA 2011-07-13 15:01:46 EDT
released for 2.0.1
Comment 4 Stephan Herrmann CLA 2011-08-17 12:03:47 EDT
Verified for 2.0.1 using build 201108160141.
Comment 5 Stephan Herrmann CLA 2012-05-23 17:22:02 EDT
Marking IP log for contributed test case in comment 0.