RFR: 8284161: Implementation of Virtual Threads (Preview)
ExE Boss
duke at openjdk.java.net
Mon Apr 11 07:36:47 UTC 2022
On Mon, 11 Apr 2022 07:12:09 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> src/java.base/share/classes/jdk/internal/misc/StructureViolationExceptions.java line 81:
>>
>>> 79: Constructor<?> ctor;
>>> 80: try {
>>> 81: Class<?> exClass = Class.forName("jdk.incubator.concurrent.StructureViolationException");
>>
>> Should this not be `jdk.internal.misc`? (Also, if this is the case, maybe there's a test missing that could have discovered this...)
>
>> Should this not be `jdk.internal.misc`? (Also, if this is the case, maybe there's a test missing that could have discovered this...)
>
> The exception is in an incubator module, it's just that code in java.base can't statically reference it.
Maybe it should use a `MethodHandle` fetched using `IMPL_LOOKUP` instead, in order to avoid the runtime overhead of going through `CallerSensitive` methods (`Class.forName` and `Constructor.newInstance`).
It should probably also be cached.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8166
More information about the core-libs-dev
mailing list