Java 8 release changes
... return a DSA KeyPairGenerator object which implements the java.security ... Java code expects JSON-parsed objects. Java libraries that manipulate JSON ...
... return a DSA KeyPairGenerator object which implements the java.security ... Java code expects JSON-parsed objects. Java libraries that manipulate JSON ...
The Collection.toArray() method returns Object[] but it doesn't make clear that the runtime type of the returned array must be Object[].
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.
But it���s not clear to me why we are not allowed to change the return type in this particular case, since Integer is a subclass of Number. If a method calling AClass.giveMeANumber() was expecting a Number object, I see no objection to giving it an Integer object.
EVALUATION The Tie throws an UnknownException containing the ClassCastException because the return object is not Serializable.