RFR: 8360303: Remove two unused invoke files
Chen Liang
liach at openjdk.org
Tue Jun 24 18:37:31 UTC 2025
On Tue, 24 Jun 2025 18:29:38 GMT, ExE Boss <duke at openjdk.org> wrote:
>> sun.invoke.empty.Empty and java.lang.invoke.InvokeDynamic are useless remnants - Empty can be replaced by java.lang.Void, and InvokeDynamic was previously used as a stub for javac to compile signature polymorphic methods. They should be removed as a cleanup.
>>
>> Testing: tier 1-3
>
> src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java line 985:
>
>> 983: }
>> 984:
>> 985: static <T extends Throwable> Void throwException(T t) throws T { throw t; }
>
> This used `sun.invoke.empty.Empty` instead of `java.lang.Void` as the former is used to mean a `Never` type, which the **Java** type system doesn’t currently have (would become `Void!` with [JEP draft 8303099]):
> https://github.com/openjdk/jdk/blob/cbcf401170e0600e48ef74770eaa47c84c7e50b0/src/java.base/share/classes/sun/invoke/empty/Empty.java#L33-L35
>
> [JEP draft 8303099]: https://openjdk.org/jeps/8303099
They are identical in `sun.invoke.util.VerifyType::isNullType`. With Empty merged into Void, this still works as intended.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25944#discussion_r2164662620
More information about the core-libs-dev
mailing list