-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
None
-
None
The instruction specification for aastore (JVMS 6.5) has these lines:
• If S is an interface type, then:
◆ If T is a class type, then T must be Object.
◆ If T is an interface type, then T must be the same interface as S or a superinterface of S.
These lines can be safely removed, since S can never be an interface type. (An implication with a vacuous condition has no force, since it cannot be falsified.) S is the runtime-type of a reference value, so it must be an array reference or concrete class reference or null.
On the other hand, the specification does not say whether a null reference will pass the run time check. That deserves clarification, since the explicitly enumerated conditions are introduced like this:
Specifically, assignment of a value of reference type S (source) to an array component of reference type T (target) is allowed only if:
...
Suggested fix: Add this line.
• If S is the null reference type, then the assignment is allowed.
Or, deal with non-null values earlier, and change the introduction of the list to:
Specifically, assignment of a +non null+ value of reference type S (source) to an array component of reference type T (target) is allowed only if
• If S is an interface type, then:
◆ If T is a class type, then T must be Object.
◆ If T is an interface type, then T must be the same interface as S or a superinterface of S.
These lines can be safely removed, since S can never be an interface type. (An implication with a vacuous condition has no force, since it cannot be falsified.) S is the runtime-type of a reference value, so it must be an array reference or concrete class reference or null.
On the other hand, the specification does not say whether a null reference will pass the run time check. That deserves clarification, since the explicitly enumerated conditions are introduced like this:
Specifically, assignment of a value of reference type S (source) to an array component of reference type T (target) is allowed only if:
...
Suggested fix: Add this line.
• If S is the null reference type, then the assignment is allowed.
Or, deal with non-null values earlier, and change the introduction of the list to:
Specifically, assignment of a +non null+ value of reference type S (source) to an array component of reference type T (target) is allowed only if
- duplicates
-
JDK-8069130 6.5: Inappropriate use of 'interface type' in aastore, checkcast, instanceof
-
- Closed
-