Bug 77228 - [1.5] Overloading checks in Eclipse 3.1 do not reflect JDK5 generics extensions
Summary: [1.5] Overloading checks in Eclipse 3.1 do not reflect JDK5 generics extensions
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-28 14:27 EDT by Lars Wunderlich CLA
Modified: 2004-11-19 12:03 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Wunderlich CLA 2004-10-28 14:27:30 EDT
The following source was tested with: Eclipse 3.1 200410260800 Integration 
Build, Sun JDK 5.0 with source level 1.5 turned on for Eclipse project.

JDK 5 was extended to include return types into full method signature check 
when overloading Generics methods inside a class. Therefore the following code 
snippet gets a clear compile in Sun JDK 5 whereas Eclipse does not compile the 
source with the following two errors:
1.) The return type is incompatible with InterfaceB.getValue(String), 
InterfaceA.getValue(String)
2.) Duplicate method getValue(String) in type ImplementationClass

InterfaceA.java file:

public interface InterfaceA {
	<T extends Integer> T getValue(String value);
}

InterfaceB.java file:

public interface InterfaceB {
	<T extends Double> T getValue(String value);
}

ImplementationClass.java file:

public class ImplementationClass implements InterfaceA, InterfaceB {
	public <T extends Integer> T getValue(String value) {
		return null;
	}
	public <T extends Double> T getValue(String value) { 
		return null;
	}
}

And there is also another problem. The IDE does not support quick fixes when 
implementing these two interface types in empty implementation class. There is 
a quick fix offered for adding unimplemented methods but nothing happens when 
selecting the quick fix.
Comment 1 Frederic Fusier CLA 2004-11-04 04:23:32 EST
*** Bug 77562 has been marked as a duplicate of this bug. ***
Comment 2 Kent Johnson CLA 2004-11-19 12:03:10 EST
But you cannot send either method. javac reports that the methods are 
ambiguous.

X.java:6: reference to getValue is ambiguous, both method <T>getValue(int) in 
X and method <T>getValue(int) in X match

I think we are better off reporting these methods as duplicates.

Now if the type variable is also a parameter type then we have a bug, which 
will be fixed soon. See bug 73971 .