Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8345565: Remove remaining SecurityManager motivated APIs from sun.reflect.util #22572

Closed
wants to merge 2 commits into from

Conversation

AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Dec 5, 2024

We hollowed out ReflectUtil as one of the early steps when removing the code for running in the SecurityManager execution mode. Most of the usages have now been removed so the empty (and unused) methods can be removed. FieldUtils and ConstructorUtils can be removed too.

ObjectInputStream/ObjectOutputStream has a left over package access check for the subclassing case that can be removed.

sun.reflect.generics.reflectiveObjects.TypeVariableImpl.getGenericDeclaration has a left over package access check that can be removed. I've changed the "should not happen" case to be an assert for now but it's in the wrong place. If we have a JDK bug in this area then it should be caught at construction time, not by the accessor method. This PR is focused on removing the use of ReflectUtil so don't want to do any more here.

The changes for java.management missed a usage ConstructorUtil.getConstructor in MBeanInstantiator.findConstructor. This is replaced, to allow ConstructorUtils be removed.

Testing: tier1-5


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8345565: Remove remaining SecurityManager motivated APIs from sun.reflect.util (Enhancement - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/22572/head:pull/22572
$ git checkout pull/22572

Update a local copy of the PR:
$ git checkout pull/22572
$ git pull https://git.openjdk.org/jdk.git pull/22572/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 22572

View PR using the GUI difftool:
$ git pr show -t 22572

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/22572.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Dec 5, 2024

👋 Welcome back alanb! 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
Copy link

openjdk bot commented Dec 5, 2024

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

8345565: Remove remaining SecurityManager motivated APIs from sun.reflect.util

Reviewed-by: mullan, rriggs, liach

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 14 new commits pushed to the master branch:

  • 97b8a09: 8345339: JFR: Missing javadoc for RecordingStream::onMetadata
  • 456c71d: 8343699: [aarch64] Bug in MacroAssembler::klass_decode_mode()
  • 308357c: 8345578: New test in JDK-8343622 fails with a promoted build
  • 84240cc: 8344831: [REDO] CDS: Parallel relocation
  • 92e9ac6: 8345294: test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java timeout with JTREG_TEST_THREAD_FACTORY=Virtual
  • b42d79e: 8345146: [PPC64] Make intrinsic conversions between bit representations of half precision values and floats
  • 7ee84d8: 8345566: Deproblemlist test/jdk/javax/swing/JComboBox/6559152/bug6559152.java
  • 01307a7: 8341551: Revisit jdk.internal.loader.URLClassPath.JarLoader after JEP 486
  • bcd1018: 8344540: Remove superseded wildcard description from java manpage
  • f3807d6: 8345403: Add more randomized tests to better cover FloatingDecimal parsing
  • ... and 4 more: https://git.openjdk.org/jdk/compare/7c8cec186a8d0e5e87baf0ece24e7bc59700263f...master

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
Copy link

openjdk bot commented Dec 5, 2024

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

  • core-libs
  • 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 serviceability serviceability-dev@openjdk.org core-libs core-libs-dev@openjdk.org labels Dec 5, 2024
@AlanBateman AlanBateman marked this pull request as ready for review December 5, 2024 10:43
@openjdk openjdk bot added the rfr Pull request is ready for review label Dec 5, 2024
@mlbridge
Copy link

mlbridge bot commented Dec 5, 2024

Webrevs

@kevinjwalls
Copy link
Contributor

The java.management change/removal looks good to me.

Copy link
Member

@seanjmullan seanjmullan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of copyright updates missing, but otherwise looks fine to me.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 5, 2024
@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Dec 5, 2024
Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for those extra cleanups.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Dec 5, 2024
throw new AssertionError("Unexpected kind of GenericDeclaration");
assert genericDeclaration instanceof Class<?> ||
genericDeclaration instanceof Method ||
genericDeclaration instanceof Constructor : "Unexpected kind of GenericDeclaration";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove this; check is already done in make factory.

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 had hoped to keep the change focused on the removal of the left over ReflectUtil.checkPackageAccess, the else throw AssertionError was a surprise to see. So yes, I agree it can be removed but I'd prefer not touch it now, future work in this area can remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, we should clean this up with things like MethodUtil.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MethodUtil is for APIs that do reflective stuff on behave of callers so not tied to the SM execution mode. That is for another time.

@AlanBateman
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Dec 5, 2024

Going to push as commit 691e692.
Since your change was applied there have been 14 commits pushed to the master branch:

  • 97b8a09: 8345339: JFR: Missing javadoc for RecordingStream::onMetadata
  • 456c71d: 8343699: [aarch64] Bug in MacroAssembler::klass_decode_mode()
  • 308357c: 8345578: New test in JDK-8343622 fails with a promoted build
  • 84240cc: 8344831: [REDO] CDS: Parallel relocation
  • 92e9ac6: 8345294: test/jdk/java/lang/Thread/virtual/RetryMonitorEnterWhenPinned.java timeout with JTREG_TEST_THREAD_FACTORY=Virtual
  • b42d79e: 8345146: [PPC64] Make intrinsic conversions between bit representations of half precision values and floats
  • 7ee84d8: 8345566: Deproblemlist test/jdk/javax/swing/JComboBox/6559152/bug6559152.java
  • 01307a7: 8341551: Revisit jdk.internal.loader.URLClassPath.JarLoader after JEP 486
  • bcd1018: 8344540: Remove superseded wildcard description from java manpage
  • f3807d6: 8345403: Add more randomized tests to better cover FloatingDecimal parsing
  • ... and 4 more: https://git.openjdk.org/jdk/compare/7c8cec186a8d0e5e87baf0ece24e7bc59700263f...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Dec 5, 2024
@openjdk openjdk bot closed this Dec 5, 2024
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Dec 5, 2024
@openjdk
Copy link

openjdk bot commented Dec 5, 2024

@AlanBateman Pushed as commit 691e692.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants