system-rules icon indicating copy to clipboard operation
system-rules copied to clipboard

UnsupportedOperationException with jdk-18

Open siom79 opened this issue 4 years ago • 5 comments

Under jdk-18 I get a UnsupportedOperationException:

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:416)
	at org.junit.contrib.java.lang.system.ProvideSecurityManager.before(ProvideSecurityManager.java:39)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:50)
	at org.junit.contrib.java.lang.system.internal.PrintStreamRule$1$1.evaluate(PrintStreamRule.java:39)
	at org.junit.contrib.java.lang.system.internal.PrintStreamHandler$3.evaluate(PrintStreamHandler.java:44)
	at org.junit.contrib.java.lang.system.internal.PrintStreamRule$1.evaluate(PrintStreamRule.java:35)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)

siom79 avatar Jan 30 '22 11:01 siom79

Same issue while trying to upgrade to JDK18 - is there a simple workaround available or a plan to get this wonderful library to work with JDK18? Thanks

ottlinger avatar Mar 28 '22 13:03 ottlinger

For now you can use -Djava.security.manager=allow but on longer run it would need majore rework - https://openjdk.java.net/jeps/411

judovana avatar Apr 27 '22 11:04 judovana

See also: https://bugs.openjdk.org/browse/JDK-8199704 (and maybe others)

dkfellows avatar May 15 '23 13:05 dkfellows

Bumped into same error when upgrading to jdk 21

zanzanYL avatar Jan 03 '24 19:01 zanzanYL

I am only using ExpectedSystemExit from system-rules. If there is alternative to this, please let me know!

zanzanYL avatar Jan 03 '24 19:01 zanzanYL