RFR: 8360303: Remove two unused invoke files

ExE Boss duke at openjdk.org
Tue Jun 24 18:33:28 UTC 2025


On Mon, 23 Jun 2025 22:48:52 GMT, Chen Liang <liach 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

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25944#discussion_r2164650420


More information about the core-libs-dev mailing list