Details
-
CSR
-
Resolution: Approved
-
P3
-
None
-
behavioral
-
low
-
-
Java API
-
SE
Description
Summary
Change Lookup::defineClass
to throw IllegalArgumentException
if the given bytes has ACC_MODULE
flag set in the access_flags
item consistent with Lookup::defineHiddenClass
.
Problem
Lookup::defineClass
does not specify what exception to throw if the given bytes has ACC_MODULE
flag set in the access_flags
item. The current implementation throws NoClassDefFoundError
(which is the behavior specified in JVMS 5.3.5).
This CSR proposes Lookup::defineClass
to specify and throw IllegalArgumentException
if the bytes has ACC_MODULE
flag set in its access_flags item to be consistent with Lookup::defineHiddenClass
.
Solution
Specify Lookup::defineClass
to throw IllegalArgumentException
if the given bytes has ACC_MODULE
flag set in the access_flags
item
Specification
Spec change in the Lookup::defineClass
method:
- * @throws IllegalArgumentException the bytes are for a class in a different package
- * to the lookup class
+ * @throws IllegalArgumentException if {@code bytes} is not a class or interface
+ * ({@code ACC_MODULE} flag is set in the value of the {@code access_flags} item) or
+ * {@bytes} denotes a class in a different package than the lookup class
Attachments
Issue Links
- csr of
-
JDK-8245596 Clarify Lookup::defineHiddenClass spec @throws IAE if the bytes has ACC_MODULE flag set
- Resolved