-
Notifications
You must be signed in to change notification settings - Fork 1.1k
@main methods requires seemingly-unnecessary permissions #9006
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
Comments
What's the runtime failure? Do you get a stacktrace showing what is trying to access these permissions? We do use sun.misc.Unsafe to implement lazy vals, but that's not specific to |
Sure. Here's the first stacktrace:
and if I add the missing permission, the next stack trace is:
and finally, after adding that permission, I get:
So it looks like it's more closely related to the collections library. I can't find a method called |
Yeah, releaseFence comes from https://github.com/scala/scala/blob/a8a726118d06c90b5506f907b1524457c0d401a7/src/library/scala/runtime/Statics.java#L147, note that it won't use sun.misc.Unsafe on Java 9+. (Dotty's lazy vals should do something similar but don't currently) |
Sounds good. Thanks for the quick response! |
I've opened #9013 to keep track of the lazy val issue. |
When running a Dotty-compiled program with a
@main
method, invoking thatmain
method requires that certain reflective permissions are granted which seem like they shouldn't be necessary. Granting them requires them to be granted to the entire application, which seems like too much of a concession to make in a security-conscious environment.Minimized code
app.scala
:policy
:Invocation:
Output
Fails at runtime unless the following permissions are set:
Expectation
Runs without exception with an empty security policy.
The text was updated successfully, but these errors were encountered: