Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8141852 | emb-9 | Harold Seigel | P3 | Resolved | Fixed | team |
JVMS 4.10.1.2 says
"Array types are subtypes of Object. The intent is also that array types are subtypes of Cloneable and java.io.Serializable.
isJavaAssignable(arrayOf(_), class('java/lang/Object', BL)) :-
isBootstrapLoader(BL).
isJavaAssignable(arrayOf(_), X) :-
isArrayInterface(X).
isArrayInterface(class('java/lang/Cloneable', BL)) :-
isBootstrapLoader(BL).
isArrayInterface(class('java/io/Serializable', BL)) :-
isBootstrapLoader(BL)."
However, typechecker allows array to be assigned to arbitrary interface. E.g. this code passes verification
public static Method castToIntf:"([Ljava/lang/Object;)Ljava/lang/Iterable;"
stack 1 locals 1
{
aload_0;
areturn;
}
"Array types are subtypes of Object. The intent is also that array types are subtypes of Cloneable and java.io.Serializable.
isJavaAssignable(arrayOf(_), class('java/lang/Object', BL)) :-
isBootstrapLoader(BL).
isJavaAssignable(arrayOf(_), X) :-
isArrayInterface(X).
isArrayInterface(class('java/lang/Cloneable', BL)) :-
isBootstrapLoader(BL).
isArrayInterface(class('java/io/Serializable', BL)) :-
isBootstrapLoader(BL)."
However, typechecker allows array to be assigned to arbitrary interface. E.g. this code passes verification
public static Method castToIntf:"([Ljava/lang/Object;)Ljava/lang/Iterable;"
stack 1 locals 1
{
aload_0;
areturn;
}
- backported by
-
JDK-8141852 Type checking verifier fails to reject assignment from array to an interface
-
- Resolved
-
- relates to
-
JDK-8328298 Hotspot-11 and 17 report Verifyerrors, but Hotspot-8 runs normally
-
- Closed
-