-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
25
Test java/lang/System/SecurityManagerWarnings.java fails with --enable-preview enabled.
The problem is that this test
makes jar from SecurityManagerWarnings.java classes. Then it executes it with
java -cp a.jar SecurityManagerWarnings run
and expects to have
java.lang.UnsupportedOperationException: Setting a Security Manager is not supported
at java.base/java.lang.System.setSecurityManager(System.java:286)
at A.run(SecurityManagerWarnings.java:113)
at SecurityManagerWarnings.main(SecurityManagerWarnings.java:66)
However, running with --enable preview generates other error
java --enable-preview -cp a.jar SecurityManagerWarnings run
Error: Unable to initialize main class SecurityManagerWarnings
Caused by: java.lang.NoClassDefFoundError: jdk/test/lib/process/OutputAnalyzer
The problem is that SecurityManagerWarnings class depends on the OutputAnalyzer.
The class is not used in the executed path and VM don't try to resolve i. But VM with --enable-preview tries to verify the main() method and resolve all dependencies.
Not sure what spec says, but from my point of view test seems wrong. It is not a good to try to run classes with unresolved dependencies.
The problem is that this test
makes jar from SecurityManagerWarnings.java classes. Then it executes it with
java -cp a.jar SecurityManagerWarnings run
and expects to have
java.lang.UnsupportedOperationException: Setting a Security Manager is not supported
at java.base/java.lang.System.setSecurityManager(System.java:286)
at A.run(SecurityManagerWarnings.java:113)
at SecurityManagerWarnings.main(SecurityManagerWarnings.java:66)
However, running with --enable preview generates other error
java --enable-preview -cp a.jar SecurityManagerWarnings run
Error: Unable to initialize main class SecurityManagerWarnings
Caused by: java.lang.NoClassDefFoundError: jdk/test/lib/process/OutputAnalyzer
The problem is that SecurityManagerWarnings class depends on the OutputAnalyzer.
The class is not used in the executed path and VM don't try to resolve i. But VM with --enable-preview tries to verify the main() method and resolve all dependencies.
Not sure what spec says, but from my point of view test seems wrong. It is not a good to try to run classes with unresolved dependencies.
- caused by
-
JDK-8351188 java launcher's implementation of (instance) main method selection can cause unexpected classloading failures
-
- Open
-
- duplicates
-
JDK-8351188 java launcher's implementation of (instance) main method selection can cause unexpected classloading failures
-
- Open
-
- relates to
-
JDK-8350714 Test vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod009/TestDescription.java fails with --enable-preview
-
- Open
-
- links to
-
Review(master) openjdk/jdk/23864