Bug 70975

Summary: [1.5] Type mismatch when compiling against binary generic method
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: 3.1 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.