JDK-4030374 - Java Issue Tracker
Feb 5, 1997 ... ... code generation error in JDK 1.1.7B compiler. It appears that non ... return Method Outer. Middle.Inner(Outer.Middle) // constructor ...
Feb 5, 1997 ... ... code generation error in JDK 1.1.7B compiler. It appears that non ... return Method Outer. Middle.Inner(Outer.Middle) // constructor ...
The Collection.toArray() method returns Object[] but it doesn't make clear that the runtime type of the returned array must be Object[].
ADVANTAGE IN THE OVERLOADED clone() METHODS: When implementing the clone method, it would allow us to cast the cloned object to the right type. It may help to trap some errors at compile time. The following code give an example with the two classes above
It's an error in java.lang.String source code which is the same for all JDK distributions.I have created a more simple example class which demonstrates this behaviour very clearly. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : See bug ID 4637640.
Collection.toArray() is specified to return an object of type Object[], but since arrays are covariant, that requirement is met by any array of a subtype of Object, for example, String[]. It's subtle, but it's clearly, if not explicitly, a bug to return an array of a subtype. See JDK-6260652.
private static boolean isEnabled(java.lang.String); descriptor: (Ljava/lang/String;)Z flags: ACC_PRIVATE, ACC_STATIC Code: stack=2, locals=1, args_size=1.