On Sat, 26 Jun 2021 16:53:30 GMT, Alan Bateman <al...@openjdk.org> wrote:
>> Weijun Wang has updated the pull request incrementally with one additional >> commit since the last revision: >> >> one more > > src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java line > 53: > >> 51: private static final long CURRENT_PID = >> AccessController.doPrivileged( >> 52: (PrivilegedAction<ProcessHandle>) >> ProcessHandle::current).pid(); >> 53: > > The original code separated out the declaration of the PrivilegedAction to > avoid this cast. If you move the code from the original static initializer > into a static method that it called from initializer then it might provide > you with a cleaner way to refactor this. There are several other places in > this patch that could do with similar cleanup. This cast is only to tell the compiler which overloaded method to call, and I don't think there will be a real cast at runtime. It might look a little ugly but extracting it into a variable declaration/definition plus a new `initStatic` method seems not worth doing, IMHO. ------------- PR: https://git.openjdk.java.net/jdk17/pull/152