Community
Participate
Working Groups
The following code compiles with javac (as of SUN 1.5.0 beta3 build 57) but not by cheetah (from CVS as of few minutes ago). Note that this is 100% valid java 1.4 code and this is how this bug is different from bug 58903 ==================================== package test.cheetah; public class IncompatibleReturnType extends java.util.ArrayList { public Object[] toArray(Object[] a) { return super.toArray(a); } } ====================================
Problem is in method verifier, method is claimed to be not compatible with super method: public <T> T[] toArray(T[] a)
Note that if defining original type as: package test.cheetah; public class IncompatibleReturnType extends java.util.ArrayList<Object> { public Object[] toArray(Object[] a) { return super.toArray(a); } } then a name clash would be signalled. The fact a raw type is used means that all type parameters are erased as well from generic methods.
*** Bug 70098 has been marked as a duplicate of this bug. ***
Released changes to erase generic method type parameters on raw types.
Fixed in Head. test149