On Tue, 7 Apr 2026 01:58:27 GMT, Shaojin Wen <[email protected]> wrote:
>> We should fix the return type of `DynamicCallSiteDesc.bootstrapMethod`;
>> luckily we can do this without breaking binary compatibility.
>
> src/java.base/share/classes/java/lang/constant/DynamicCallSiteDesc.java line
> 305:
>
>> 303: }
>> 304:
>> 305: sealed interface BootstrapMethodHook {
>
> **[Nice to have]** The `BootstrapMethodHook` sealed interface lacks an
> explicit `permits DynamicCallSiteDesc` clause, relying on implicit
> same-compilation-unit permits. All 7 other sealed types in
> `java.lang.constant` (`ConstantDesc`, `MethodHandleDesc`,
> `DirectMethodHandleDesc`, `ClassDesc`, `MethodTypeDesc`, `ModuleDesc`,
> `PackageDesc`) use explicit `permits` clauses.
>
> Consider adding `permits DynamicCallSiteDesc` for consistency:
>
> sealed interface BootstrapMethodHook permits DynamicCallSiteDesc {
> MethodHandleDesc bootstrapMethod();
> }
>
>
> _— glm-5.1 via Qwen Code /review_
Note that all the other `sealed` types are in separate compilation units from
their permitted subtypes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/30351#discussion_r3186535303