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

kt_jvm_test is incompatible with Java >= 18 #1100

Open
josephglanville opened this issue Jan 4, 2024 · 1 comment
Open

kt_jvm_test is incompatible with Java >= 18 #1100

josephglanville opened this issue Jan 4, 2024 · 1 comment
Assignees
Labels
component: jvm type: cleanup Refactorings, idiomatic transforms, tech debt payoff

Comments

@josephglanville
Copy link
Contributor

Because of deprecation of the Security Manager APIs becoming an error in Java 18 kt_jvm_test will fail with the following error:

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:429)
	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)

This can be worked around by specifying the appropriate JVM flags in .bazelrc:

common --jvmopt=-Djava.security.manager=allow

The correct fix however would be to port across the change made to the upstream Java test rule and read the runtime version from JavaRuntimeInfo and conditionally set the appropriate JVM option, see the Bazel issue for more details including the linked fix commit: bazelbuild/bazel#16421

@restingbull
Copy link
Collaborator

Need to update to junit5 as the default.

@restingbull restingbull self-assigned this Jan 5, 2024
@restingbull restingbull added component: jvm type: cleanup Refactorings, idiomatic transforms, tech debt payoff labels Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: jvm type: cleanup Refactorings, idiomatic transforms, tech debt payoff
Projects
None yet
Development

No branches or pull requests

2 participants