On Tue, 24 Jun 2025 18:29:38 GMT, ExE Boss <d...@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

Reply via email to