On Fri, 25 Jun 2021 23:40:27 GMT, Weijun Wang <wei...@openjdk.org> wrote:

>> More refactoring to limit the scope of `@SuppressWarnings` annotations.
>> 
>> Sometimes I introduce new methods. Please feel free to suggest method names 
>> you like to use.
>
> 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.

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

PR: https://git.openjdk.java.net/jdk17/pull/152

Reply via email to