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
Conversation
try { | ||
java.security.AccessController.doPrivileged((() => cls.getField("MODULE$").get(null)): PrivilegedExceptionAction[Object]) | ||
} catch { | ||
@deprecated("", "") // because AccessController is deprecated on JDK 17 |
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.
Is this to work around unused-nowarn warnings? We disabled those https://github.com/scala/scala/blob/2.13.x/build.sbt#L165
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.
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.
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.
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?
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.
Ah I understand your unused nowarn point now. Derp
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.
NP, i was just wondering if there's a usability issue with @nowarn
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'd missed #9707. I'll clean it up: scala/scala-dev#794
a tiny sequel to #9752