-
Notifications
You must be signed in to change notification settings - Fork 149
8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K #152
Conversation
👋 Welcome back weijun! A progress list of the required criteria for merging this PR into |
@wangweij The following labels will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command. |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good Max
@wangweij This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 10 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the ➡️ To integrate this PR with the above commit message to the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@SuppressWarnings("removal") | ||
private static final long CURRENT_PID = AccessController.doPrivileged( | ||
(PrivilegedAction<ProcessHandle>) ProcessHandle::current).pid(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not simply declare a local variable in the static initializer below?
private static final long CURRENT_PID;
private static final boolean ALLOW_ATTACH_SELF;
static {
PrivilegedAction<ProcessHandle> pa = ProcessHandle::current;
@SuppressWarnings("removal")
long pid = AccessController.doPrivileged(pa).pid();
CURRENT_PID = pid;
String s = VM.getSavedProperty("jdk.attach.allowAttachSelf");
ALLOW_ATTACH_SELF = "".equals(s) || Boolean.parseBoolean(s);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just pushed a commit with a different fix:
private static final long CURRENT_PID = pid();
@SuppressWarnings("removal")
private static long pid() {
PrivilegedAction<ProcessHandle> pa = () -> ProcessHandle.current();
return AccessController.doPrivileged(pa).pid();
}
I'm going to move this to jdk18. |
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.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk17 pull/152/head:pull/152
$ git checkout pull/152
Update a local copy of the PR:
$ git checkout pull/152
$ git pull https://git.openjdk.java.net/jdk17 pull/152/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 152
View PR using the GUI difftool:
$ git pr show -t 152
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jdk17/pull/152.diff