RFR: 6983726: Reimplement MethodHandleProxies.asInterfaceInstance [v16]

Mandy Chung mchung at openjdk.org
Fri May 26 22:08:15 UTC 2023


On Fri, 26 May 2023 21:06:36 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java line 209:
>> 
>>> 207:         if (intfc.isHidden())
>>> 208:             throw newIllegalArgumentException("a hidden interface", intfc.getName());
>>> 209:         if (!VM.isModuleSystemInited())
>> 
>> I don't expect this is needed.  I assume you are thinking for LMF to use this API?
>
> Proxy-based impl had this check, so I'd assume MHP might want to defend against the same kind of improper usage.

Proxy is used by annotation implementation.   I suspect that's why that check was there.

For `MHP::asInterfaceInstance`, I would drop the `isModuleSystemInitied` check until the API is being used during early startup.   I don't expect it be called before module system is initialized.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13197#discussion_r1207391651


More information about the core-libs-dev mailing list