RFR: 8351996: Behavioral updates for ClassValue::remove [v12]

ExE Boss duke at openjdk.org
Thu Aug 7 17:51:24 UTC 2025


On Thu, 8 May 2025 16:06:27 GMT, Chen Liang <liach at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/ClassValue.java line 241:
>> 
>>> 239:                 } else {
>>> 240:                     throw ex instanceof Error err ? err : new Error(ex);
>>> 241:                 }
>> 
>> Hello Chen, i think this if/else for exception type checks can instead just be replaced with an unconditional `throw ex`;
>
> I tried that and failed compilation before

This could also use `jdk.internal.misc.Unsafe​::throwException​(Throwable)`:

Unsafe.getUnsafe().throwException(ex);
return null;

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24043#discussion_r2261045331


More information about the core-libs-dev mailing list