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 ...
Java SE. Community. Bug Database.The Collection.toArray() method returns Object[] but it doesn't make clear that the runtime type of the returned array must be Object[]. (Oddly, that is specified in toArray(T[]) which is in the wrong place.)
- If the return types are unrelated functional interface types (however this is defined -- see JDK-8037804), then the old logic says they're both more specific than the other, and the new logic says neither is more specific. Either way, ambiguity error.
A DESCRIPTION OF THE PROBLEM : Direct array element access (within a single line) of a wildcard generic type with an array typed upper bound fails with the following compilation error: GenericTest.java:6: error: array required, but CAP#1 found return foo.call()[0]
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.