-
Type:
CSR
-
Resolution: Approved
-
Priority:
P4
-
Component/s: core-libs
-
None
-
behavioral
-
low
-
Exceptions changed, but users are not expected to programmatically handle such exceptions, and most calls to this method are generated correctly by compilers like javac.
-
Java API
-
Implementation
Summary
Add missing validation to java.lang.runtime.ObjectMethods::bootstrap for its getters argument.
Problem
bootstrap specifies if any argument is invalid or inconsistent, it throws IllegalArgumentException. However, when a method handle in getters misbehave in one of the three ways:
- Returns
void - Not exactly one receiver argument
- Receiver argument is not of the
recordClasstype
This method proceeds without initial checks and throws generic exceptions from method handle infrastructures later, making the exceptions confusing.
Solution
Add checks for these 3 conditions so such getter method handles are rejected early on with an IllegalArgumentException.
Specification
None. This is purely a behavioral change.
- csr of
-
JDK-8378792 ObjectMethods.bootstrap missing getter validation
-
- Resolved
-