Community
Participate
Working Groups
Acutally I report this against Eclipse 3.1M1, but Bugzilla didn't let me specify this. For the following test file, the line (1) does compile using Sun's JDK1.5.0RC, but not using Eclipse 3.1M1. The compiler error for "visit" is: "The method visit(? super Test.I) in the type Test.Visitor<? super Test.I> is not applicable for the arguments (Test.C)". In my opinion is should compile. The line (2) is a workaround. Please check and fix such that line (1) compiles. class Test { static interface I extends Visitible<I> { } static interface Visitible<T> { void acceptVisitor(Visitor<? super T> visitor); } static interface Visitor<T> { void visit(T t); } static class C implements I { public void acceptVisitor(Visitor<? super I> visitor) { visitor.visit(this); // (1) Compilable with Sun JDK1.5.0RC, but not // with Eclipse3.1M1 visitor.visit((I) this); // (2) This is a workaround } } }
Fixed by changing Wildcard#boundCheck to allow SUPER scenario to tolerate subtype as well (since could be cast to uppertype). Added regression test: GenericTypeTest#test300 + test395.
Fixed
*** Bug 74178 has been marked as a duplicate of this bug. ***
Verified in 200412140800