Community
Participate
Working Groups
Build ID: M20080221-1800 (Why oh why do I need to add the Eclipse version if the Build Id is supplied -- this is a GUI blooper: making a user fill information already determinable. It's like having to fill out ZIP code _and_ state address information). Note this bug probably needs to go to JDT:Core, but the wizard doesn't make that easy or apparent. Steps To Reproduce: 1) see attached project tar file. 2) Load up project. Compile project. Everything is fine. 3) Set up for java1.6 from Apple. Perform "ant clean; ant" and observe the compiler error. 4) Determine if Sun/Apple has a bug or conform Eclipse to java1.6 spec. This bug probably plagues 1.5 as well. More information:
Created attachment 108098 [details] The project tar that I tried to attach in the original. Attaching tar files seems to be problematic, the original post failed to attach the tar file. Additionally, using the BACK button to correct errors loses information in form to used to attach files (such as the tar file I am trying to attach). :/ GOOIE Blooper.
(In reply to comment #0) > Build ID: M20080221-1800 (Why oh why do I need to add the Eclipse version if > the Build Id is supplied -- this is a GUI blooper: making a user fill > information already determinable. It's like having to fill out ZIP code _and_ > state address information). The version field is not always sufficient actually. If a user uses a weekly build or something, then that build is not going to be a match for the entries that's in the version field. And by the way, you've set the version field as 3.2.2 but the build id you have (presumably) copy/pasted is actually the build id for the 3.3.2 build. :) Anyway, I seem to be able to reproduce this using Sun's 1.6.0.05 JDK on Linux. This is my output from Ant (although I modified the build file a little). [javac] Compiling 1 source file to /home/rcjsuen/eclipse-workspace/GenericsTestCase/build [javac] /home/rcjsuen/eclipse-workspace/GenericsTestCase/src/SubClassOfGeneric.java:18: cannot select from a type variable [javac] V.MyInnerClass foo = m_test.getMyInnerClass(); [javac] ^ [javac] 1 error This is how it looks from a straight command-line JDK 6 javac invocation. rcjsuen@ivalice ~/eclipse-workspace/GenericsTestCase/src $ /opt/sun-jdk-1.6.0.05/bin/javac *.java SubClassOfGeneric.java:18: cannot select from a type variable V.MyInnerClass foo = m_test.getMyInnerClass(); ^ 1 error And here's my JDK 5 javac invocation. rcjsuen@ivalice ~/eclipse-workspace/GenericsTestCase/src $ /opt/sun-jdk-1.5.0.15/bin/javac *.java SubClassOfGeneric.java:18: incompatible types found : GenericWithInner<T>.MyInnerClass required: GenericWithInner.MyInnerClass V.MyInnerClass foo = m_test.getMyInnerClass(); ^ 1 error
This continues to compile fine with I20080731-0950 and fails with Sun's JDK 1.5.0.16 and 1.6.0.7.
The testcase can be reduce to : class GenericWithInner<T> { class M {} } class SubClassOfGeneric<V extends GenericWithInner<V>> { void testMethod(V.M m) {} // error: cannot select from a type variable } Same error should be detected from any other qualified reference that attempts to extract a member type from a type variable
Here's another testcase with a few more references : class X<T> { class M {} static int i; static int foo() { return i; } } class Y<T extends X<T>> { int i = T.i + T.foo(); void test(T.M m) {} // javac error: cannot select from a type variable } javac allows inherited field and method references thru T's upperbound X<T>, but javac doesn't allow a reference to a member type. Philippe - any comment ?
Just found the javac bug report http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6569404 Closing as a duplicate of bug 142897 *** This bug has been marked as a duplicate of bug 142897 ***
See GenericTypeTest#test0997 for a testcase with a qualified reference to a member type thru a type variable.
Verified for 3.5M2 that this is a dup of bug 142897