Community
Participate
Working Groups
This compiles OK in both Eclipse and javac: 1: interface TestGeneric1<A> 2: { 3: NonNested<A> getNonNested(); 4: } 5: 6: class NonNested<B> implements TestGeneric1<B> 7: { 8: public NonNested<B> getNonNested() 9: { 10: return this; 11: } 12: } But this doesn't compile in Eclipse, even though it compiles find in javac: 1: interface TestGeneric2<A> 2: { 3: Nested<A> getNested(); 4: 5: class Nested<B> implements TestGeneric2<B> 6: { 7: public Nested<B> getNested() 8: { 9: return this; 10: } 11: } 12: } The Nested class is automatically static because it is nested in an interface, yet the compile errors Eclipse gives are: Line 7: "The return type is incompatible with TestGeneric2<B>.getNested()" Line 9: "Type mismatch: cannot convert from TestGeneric2<A>.Nested<B> to TestGeneric2<B>.Nested" The reference in the error message to "TestGeneric2<A>.Nested<B>" is nonsensical, since Nested<B> is a static member of TestGeneric2.
(Typo - I meant to say, "...even though it compiles fine in javac")
Actually, the reference in the error message to "TestGeneric2<B>.Nested" is also nonsensical, for the same reason.
Reproduced in RC2.
We did not construct proper parameterized types in these few situations where implicit static member types were referenced. We were using generic type binding in place of a parameterized type where enclosing is a raw type. Fix is available. +1 for RC3 Dirk - would you please vote for it ?
Added GenericTypeTest#test743
Created attachment 22919 [details] Patch for jdt/core
+1 for RC3. Is there any impact on JDT/UI you can think of ?
It should only be better, as offending bindings were really misleading. We will run your test anyway.
JDT UI amd Refactoring tests are passing with this patch (ignoring the known failure for TypeRulesTest#testIsCastCompatible())
Thanks Jerome. Will release to HEAD.
Verified using N20050616-0010 + JDT/Core HEAD