add `java_runtime` version field for JDK 17+
Closed this issue · 1 comments
malt3 commented
java_test
rules fail when used with JDK 17+:
JUnit4 Test Runner
java.lang.UnsupportedOperationException: The Security Manager is deprecated and will be removed in a future release
at java.base/java.lang.System.setSecurityManager(System.java:425)
at com.google.testing.junit.runner.junit4.JUnit4Runner.installSecurityManager(JUnit4Runner.java:256)
at com.google.testing.junit.runner.junit4.JUnit4Runner.run(JUnit4Runner.java:113)
at com.google.testing.junit.runner.BazelTestRunner.runTestsInSuite(BazelTestRunner.java:145)
at com.google.testing.junit.runner.BazelTestRunner.main(BazelTestRunner.java:76)
BazelTestRunner exiting with a return value of 1
JVM shutdown hooks (if any) will run now.
The JVM will exit once they complete.
-- JVM shutdown starting at 2024-06-04 07:26:09 --
Describe the solution you'd like
There is an upstream solution in Bazel 7+: bazelbuild/bazel@7556e11
This requires us to set the version
field of the runtime:
java_runtime(
name = "..."
java = "..."
# ...
version = 19,
)
Describe alternatives you've considered
Add this to .bazelrc:
common --jvmopt=-Djava.security.manager=allow
Additional context
Happy to work on this. Just needed to write that down somewhere.
benradf commented
It would be good to have this fixed. Feel free to open a pull request when you're ready.