diff src/java.base/share/classes/sun/misc/Version.java.template @ 13209:c95bba55626c

8139986: Store debug level in java.vm.debug and conditionally print in "java -version" Reviewed-by: ihse, dcubed, ksrini, dholmes Contributed-by: alejandro.murillo@oracle.com, kumar.x.srinivasan@oracle.com
author amurillo
date Wed, 04 Nov 2015 16:02:53 -0800
parents 9cea16b048db
children
line wrap: on
line diff
--- a/src/java.base/share/classes/sun/misc/Version.java.template	Sun Nov 01 09:49:05 2015 -0800
+++ b/src/java.base/share/classes/sun/misc/Version.java.template	Wed Nov 04 16:02:53 2015 -0800
@@ -98,7 +98,15 @@
 
         /* Second line: runtime version (ie, libraries). */
 
-        ps.print(java_runtime_name + " (build " + java_runtime_version);
+        String jdk_debug_level = System.getProperty("jdk.debug", "release");
+        /* Debug level is not printed for "release" builds */
+        if ("release".equals(jdk_debug_level)) {
+            jdk_debug_level = "";
+        } else {
+            jdk_debug_level = jdk_debug_level + " ";
+        }
+
+        ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
 
         if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
             // embedded builds report headless state
@@ -110,7 +118,7 @@
         String java_vm_name    = System.getProperty("java.vm.name");
         String java_vm_version = System.getProperty("java.vm.version");
         String java_vm_info    = System.getProperty("java.vm.info");
-        ps.println(java_vm_name + " (build " + java_vm_version + ", " +
+        ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " +
                    java_vm_info + ")");
     }