RFR: 8027314: Java should recognize Diagnostic options if -XX:+UnlockDiagnosticVMOptions is not specified and print an informative message

Calvin Cheung calvin.cheung at oracle.com
Tue Jan 14 17:22:12 PST 2014


This fix is for clarifying the error messages associated with vm options 
of type
diagnostic, experimental, develop, and notproduct.

Summary of fix:
- added an optional boolean (return_flag) parameter in Flag::find_flag() 
so that
Arguments::process_argument() can inspect the returned flag and call
into get_locked_message();
- added new function is_product_build() in globals.[c|h]pp;
- in get_locked_message(), issues the appropriate error message;
- added a new test VMOptionWarning.java;
- minor cleanup in the existing tests - ConfigFileWarning, 
CompilerConfigFileWarning.

Sample output:
---------------

Before fix:

C:\jdk8_i586\jdk1.8.0\bin\java -XX:+PrintInlining -version
Improperly specified VM option 'PrintInlining'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

After fix:

C:\jdk8_i586\jdk1.8.0\bin\java -XX:+PrintInlining -version
Error: VM option 'PrintInlining' is diagnostic and must be enabled via 
-XX:+UnlockDiagnosticVMOptions.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Before fix:

c:\jdk9_i586\jdk1.9.0\bin\java  -XX:+TraceJNICalls -version
Unrecognized VM option 'TraceJNICalls'
Did you mean '(+/-)TraceJNICalls'?
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

After fix:

C:\jdk8_i586\jdk1.8.0\bin\java -XX:+TraceJNICalls -version
Error: VM option 'TraceJNICalls' is develop and is available only in 
debug version of VM.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Testing:
     manual test via command line and the new test VMOptionWarning.

Bug:
     https://bugs.openjdk.java.net/browse/JDK-8027314

Webrev:
     http://cr.openjdk.java.net/~ccheung/8027314/webrev/

thanks,
Calvin


More information about the hotspot-runtime-dev mailing list