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

suppress JDK 17 deprecation warning in ModuleSerializationProxy #9785

Merged
merged 1 commit into from Oct 12, 2021

Conversation

SethTisue
Copy link
Member

a tiny sequel to #9752

@scala-jenkins scala-jenkins added this to the 2.13.7 milestone Oct 12, 2021
@SethTisue SethTisue added the internal not resulting in user-visible changes (build changes, tests, internal cleanups) label Oct 12, 2021
@SethTisue SethTisue merged commit 1b840d3 into scala:2.13.x Oct 12, 2021
@SethTisue SethTisue deleted the suppress-jdk17-warning branch October 12, 2021 22:09
try {
java.security.AccessController.doPrivileged((() => cls.getField("MODULE$").get(null)): PrivilegedExceptionAction[Object])
} catch {
@deprecated("", "") // because AccessController is deprecated on JDK 17
Copy link
Member

Choose a reason for hiding this comment

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

Is this to work around unused-nowarn warnings? We disabled those https://github.com/scala/scala/blob/2.13.x/build.sbt#L165

Copy link
Member

Choose a reason for hiding this comment

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

No AccessController is deprecated, so we're hiding that call in a deprecated method and then suppressing that deprecation.

The class is deprecated because SecurityManager is deprecated so this is in alternative to starting to introduce a scala/library-java-17+ or something, just so we don't wrap the call when compiling the stdlib on java 17, which seems fine to me.

Copy link
Member

Choose a reason for hiding this comment

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

we're hiding that call in a deprecated method and then suppressing that deprecation

I don't understand why we need this indirection, AccessController's deprecation can't be suppressed directly?

Copy link
Member

Choose a reason for hiding this comment

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

Ah I understand your unused nowarn point now. Derp

Copy link
Member

Choose a reason for hiding this comment

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

NP, i was just wondering if there's a usability issue with @nowarn

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd missed #9707. I'll clean it up: scala/scala-dev#794

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal not resulting in user-visible changes (build changes, tests, internal cleanups)
Projects
None yet
4 participants