Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 323473 - [1.5][generics] Eclipse compiles code rejected by javac
Summary: [1.5][generics] Eclipse compiles code rejected by javac
Status: RESOLVED DUPLICATE of bug 322531
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-24 06:30 EDT by Srikanth Sankaran CLA
Modified: 2011-06-03 03:26 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 ***