Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K #152

Closed
wants to merge 3 commits into from
Closed

Conversation

wangweij
Copy link
Contributor

@wangweij wangweij commented Jun 25, 2021

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

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K

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

@bridgekeeper
Copy link

bridgekeeper bot commented Jun 25, 2021

👋 Welcome back weijun! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jun 25, 2021
@openjdk
Copy link

openjdk bot commented Jun 25, 2021

@wangweij The following labels will be automatically applied to this pull request:

  • core-libs
  • i18n
  • net
  • security
  • serviceability

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.

@openjdk openjdk bot added security security-dev@openjdk.java.net serviceability serviceability-dev@openjdk.java.net core-libs core-libs-dev@openjdk.java.net net net-dev@openjdk.java.net i18n i18n-dev@openjdk.java.net labels Jun 25, 2021
@mlbridge
Copy link

mlbridge bot commented Jun 25, 2021

Webrevs

Copy link
Contributor

@LanceAndersen LanceAndersen left a 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

@openjdk
Copy link

openjdk bot commented Jun 25, 2021

@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:

8269409: Post JEP 411 refactoring: core-libs with maximum covering > 10K

Reviewed-by: lancea, naoto

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 master branch:

  • e4c5446: 8268236: The documentation of the String.regionMatches method contains error
  • d9cb068: 8258746: illegal access to global field _jvmci_old_thread_counters by terminated thread causes crash
  • 6eb734a: 8266269: Lookup::accessClass fails with IAE when accessing an arrayClass with a protected inner class as component class
  • 3d0d27c: 8269351: Proxy::newProxyInstance and MethodHandleProxies::asInterfaceInstance should reject sealed interfaces
  • 824a516: 8269260: Add AVX512 and other SSE + AVX combinations testing for tests which generate vector instructions
  • 1404e4b: 8269302: serviceability/dcmd/framework/InvalidCommandTest.java still fails after JDK-8268433
  • fb0a95f: 8269036: tools/jpackage/share/AppImagePackageTest.java failed with "hdiutil: create failed - Resource busy"
  • 5ebed06: 8269074: (fs) Files.copy fails to copy from /proc on some linux kernel versions
  • d799563: 8256919: BCEL: Utility.encode forget to close
  • 1e3b418: 8269335: Unable to load svml library

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jun 25, 2021
Copy link
Member

@naotoj naotoj left a 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();

Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

@dfuch dfuch Jun 28, 2021

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);
    }

Copy link
Contributor Author

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();
    }

@wangweij
Copy link
Contributor Author

I'm going to move this to jdk18.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
core-libs core-libs-dev@openjdk.java.net i18n i18n-dev@openjdk.java.net net net-dev@openjdk.java.net ready Pull request is ready to be integrated rfr Pull request is ready for review security security-dev@openjdk.java.net serviceability serviceability-dev@openjdk.java.net
Development

Successfully merging this pull request may close these issues.

5 participants