Bug 351317

Summary: Error in (redundant) cast of anchored type
Product: [Tools] Objectteams Reporter: Andreas Mertgen <programmfehler>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: stephan.herrmann
Version: 2.0Flags: stephan.herrmann: iplog+
Target Milestone: 2.0.1   
Hardware: PC   
OS: Windows 7   
Whiteboard: Also released in 2.1 M1
Attachments:
Description Flags
test & fix none

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.