RFR: 8268164: Adopt cast notation for WorkerThread conversions
Albert Mingkun Yang
ayang at openjdk.java.net
Thu Jun 3 12:02:36 UTC 2021
On Thu, 3 Jun 2021 11:38:07 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> I wonder if it wouldn't be nicer to be able to write:
>
> ```
> WorkerThread::current()->id()
> ```
That will cause a compiling error:
src/hotspot/share/gc/shared/referenceProcessor.cpp:933:35: error: no member named 'id' in 'Thread'
id = WorkerThread::current()->id();
~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.
`WorkerThread` doesn't have a static `current()` method, so it will get the one from `Thread`, which returns a `Thread*`. However, `id()` is only defined for `WorkerThread`, not `Thread`.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4334
More information about the hotspot-dev
mailing list