Bug 70975 - [1.5] Type mismatch when compiling against binary generic method
Summary: [1.5] Type mismatch when compiling against binary generic method
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-28 09:54 EDT by Philipe Mulet CLA
Modified: 2005-01-11 11:02 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philipe Mulet CLA 2004-07-28 09:54:03 EDT
JDTCore v_501

When compiling the following program:

public class Y {
    public static void main(String [] args) {
		X<String> xs = new X<String>();
		String[] s = xs.bar(new String[0]);
    }
}

against binaries for X defined as:
public class X <T> {
	<U> U[] bar(U[] u)  { return null; }
}

an invalid type mismatch is reported: 
    Type mismatch: cannot convert from Object[] to String[]
Comment 1 Philipe Mulet CLA 2004-07-28 09:55:19 EDT
Looks like problem is located in generation of generic method. Some 
attributes/signatures is invalid, and thus when read back in, the method is 
thought to be:  <U> Object[] bar(Object[]).
Comment 2 Philipe Mulet CLA 2004-07-28 09:55:58 EDT
Added regression test: GenericTypeTest#test269
Comment 3 Philipe Mulet CLA 2004-07-28 09:58:50 EDT
Indeed, signature for generic method got generated as:

<U:Ljava/lang/Object;>([Ljava/lang/Object;)[Ljava/lang/Object;

instead of:

<U:Ljava/lang/Object;>([TU;)[TU;
Comment 4 Philipe Mulet CLA 2004-07-28 10:00:42 EDT
This arises because of array types, if dumping signature for:
<U> U bar(U u)   correctly issues: <U:Ljava/lang/Object;>(TU;)TU;
Comment 5 Philipe Mulet CLA 2004-07-28 10:06:05 EDT
ArrayBinding did not override #genericTypeSignature().
Fixed.