Skip to content

GH-3896: Remove AccessController.doPrivileged usage - #3902

Merged
Fokko merged 1 commit into
apache:masterfrom
Fokko:jdk17-remove-doprivileged
Oct 29, 2026
Merged

Fokko merged 1 commit into
apache:masterfrom
Fokko:jdk17-remove-doprivileged

Conversation

@Fokko

@Fokko Fokko commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Rationale for this change

AccessController and PrivilegedAction are deprecated for removal since JDK 17 (JEP 411). Without a SecurityManager, doPrivileged just runs the action, and the minimum JDK is now 17.

What changes are included in this PR?

  • DynMethods / DynConstructors: call setAccessible(true) directly and drop the private MakeAccessible helpers. InaccessibleObjectException is caught next to SecurityException, so an implementation that can't be made accessible is still skipped instead of failing the builder.
  • parquet-cli BaseCommand: build the URLClassLoader directly and delete the GetClassLoader PrivilegedAction.

Are these changes tested?

Covered by the existing tests: TestDynMethods, TestDynConstructors and the parquet-cli test suite.

Are there any user-facing changes?

No.

Closes #3896

This pull request and its description were written by Isaac.

AccessController and PrivilegedAction are deprecated for removal since
JDK 17 (JEP 411), and without a SecurityManager doPrivileged just runs
the action. Now that the minimum JDK is 17, call the code directly:

- DynMethods/DynConstructors: call setAccessible(true) directly and drop
  the private MakeAccessible helpers. InaccessibleObjectException is now
  caught next to SecurityException, so an impl that can't be made
  accessible is still skipped instead of failing the builder.
- parquet-cli BaseCommand: build the URLClassLoader directly in a small
  private helper and delete the GetClassLoader PrivilegedAction.

Co-authored-by: Isaac <no-reply@databricks.com>
@Fokko
Fokko requested a review from wgtmac October 28, 2026 23:07
@Fokko
Fokko merged commit 18f66d8 into apache:master Oct 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove AccessController.doPrivileged usage

2 participants