Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 323473

Summary: [1.5][generics] Eclipse compiles code rejected by javac
Product: [Eclipse Project] JDT Reporter: Srikanth Sankaran <srikanth_sankaran>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Srikanth Sankaran CLA 2010-08-24 06:30:21 EDT
Eclipse 3.6 compiles the following code without any
errors

interface List<E> {}
interface I {}

public class X {
    <T extends I> void main(List<T> clazz, List<X> xList) {
        boolean b = clazz == xList ||
		    xList == clazz;
    }
}

while javac complains:

X.java:6: incomparable types: List<T> and List<X>
        boolean b = clazz == xList ||
                          ^
X.java:7: incomparable types: List<X> and List<T>
                    xList == clazz;
                          ^
2 errors

C:\jtests>rem C:\ibm-java2-sdk-50-win-i386\bin\javac.exe -Xlint:unchecked -Xlint
:rawtypes -verbose -sourcepath c:\jtests X.java

but if you make Test a final class, eclipse also complains.

In the exact same contexts, eclipse has no hesitation in
flagging an assignment as being illegal.

See also bug 322531
Comment 1 Srikanth Sankaran CLA 2010-08-29 22:28:49 EDT
I'll investigate this.
Comment 2 Srikanth Sankaran CLA 2011-06-03 03:26:17 EDT
Same issue as bug 322531

*** This bug has been marked as a duplicate of bug 322531 ***