-
Type:
Sub-task
-
Resolution: Unresolved
-
Priority:
P4
-
None
-
Affects Version/s: 26
-
Component/s: core-libs
The specification of [java.lang.runtime.ObjectMethods.bootstrap][ObjectMethods.bootstrap] method incorrectly claims its `MethodHandles.Lookup` argument is unused; it may cause an exception if the `lookup` does not have full privilege access.
Since JDK 18, it consistently throws a `RuntimeException` caused by `StringConcatException` if the `lookup` does not have full privilege access. The `methodName` is `"toString"`, and all other arguments are valid. Beginning in JDK 26, it may throw an `IllegalAccessException` or return normally if the `lookup` does not have full privilege access, the `methodName` is `"hashCode"` or `"equals"`, and all other arguments are valid.
The overwhelming majority of uses of `ObjectMethods.bootstrap` are through bootstrap methods. These provide a full-privilege lookup and are therefore not affected. This inconsistent behavior will be addressed by JDK-8378796 in JDK 27.
Since JDK 18, it consistently throws a `RuntimeException` caused by `StringConcatException` if the `lookup` does not have full privilege access. The `methodName` is `"toString"`, and all other arguments are valid. Beginning in JDK 26, it may throw an `IllegalAccessException` or return normally if the `lookup` does not have full privilege access, the `methodName` is `"hashCode"` or `"equals"`, and all other arguments are valid.
The overwhelming majority of uses of `ObjectMethods.bootstrap` are through bootstrap methods. These provide a full-privilege lookup and are therefore not affected. This inconsistent behavior will be addressed by JDK-8378796 in JDK 27.