Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/ikvm-fork.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjfrijters <jfrijters>2012-05-24 11:49:06 +0400
committerjfrijters <jfrijters>2012-05-24 11:49:06 +0400
commit76882b1550e3d6546ab35e69e0a7c5a54b7d2754 (patch)
tree0ed18f6340e783179a709c4c068482fb0488bd20 /openjdk/sun
parent53c76ac3c970f31242b926676c1b956965c6903b (diff)
Merged sun.misc.Version changes.
Diffstat (limited to 'openjdk/sun')
-rw-r--r--openjdk/sun/misc/Version.java69
1 files changed, 45 insertions, 24 deletions
diff --git a/openjdk/sun/misc/Version.java b/openjdk/sun/misc/Version.java
index 3865edd9..7e0f3724 100644
--- a/openjdk/sun/misc/Version.java
+++ b/openjdk/sun/misc/Version.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,25 +30,22 @@ public class Version {
private static final String launcher_name =
- "@@launcher_name@@";
+ "openjdk";
private static final String java_version =
- "@@java_version@@";
-
- private static final String java_runtime_name =
- "@@java_runtime_name@@";
+ "1.7.0-internal";
+ private static final String java_runtime_name =
+ "OpenJDK Runtime Environment";
+
private static final String java_runtime_version =
- "@@java_runtime_version@@";
+ "1.7.0-internal-jeroen_2012_05_22_06_05-b00";
static {
init();
}
public static void init() {
- //System.setProperty("java.version", java_version);
- //System.setProperty("java.runtime.version", java_runtime_version);
- //System.setProperty("java.runtime.name", java_runtime_name);
}
private static boolean versionsInitialized = false;
@@ -75,15 +72,38 @@ public class Version {
}
/**
+ * This is the same as print except that it adds an extra line-feed
+ * at the end, typically used by the -showversion in the launcher
+ */
+ public static void println() {
+ print(System.err);
+ System.err.println();
+ }
+
+ /**
* Give a stream, it will print version info on it.
*/
public static void print(PrintStream ps) {
+ boolean isHeadless = false;
+
+ /* Report that we're running headless if the property is true */
+ String headless = System.getProperty("java.awt.headless");
+ if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
+ isHeadless = true;
+ }
+
/* First line: platform version. */
ps.println(launcher_name + " version \"" + java_version + "\"");
/* Second line: runtime version (ie, libraries). */
- ps.println(java_runtime_name + " (build " +
- java_runtime_version + ")");
+
+ ps.print(java_runtime_name + " (build " + java_runtime_version);
+
+ if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
+ // embedded builds report headless state
+ ps.print(", headless");
+ }
+ ps.println(')');
/* Third line: JVM information. */
String java_vm_name = System.getProperty("java.vm.name");
@@ -93,6 +113,7 @@ public class Version {
java_vm_info + ")");
}
+
/**
* Returns the major version of the running JVM if it's 1.6 or newer
* or any RE VM build. It will return 0 if it's an internal 1.5 or
@@ -246,29 +267,29 @@ public class Version {
}
jvmVersionInfoAvailable = getJvmVersionInfo();
if (!jvmVersionInfoAvailable) {
- // parse java.vm.version for older JVM before the
+ // parse java.vm.version for older JVM before the
// new JVM_GetVersionInfo is added.
// valid format of the version string is:
// n.n.n[_uu[c]][-<identifer>]-bxx
CharSequence cs = System.getProperty("java.vm.version");
- if (cs.length() >= 5 &&
- Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
+ if (cs.length() >= 5 &&
+ Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' &&
Character.isDigit(cs.charAt(4))) {
- jvm_major_version = Character.digit(cs.charAt(0), 10);
+ jvm_major_version = Character.digit(cs.charAt(0), 10);
jvm_minor_version = Character.digit(cs.charAt(2), 10);
jvm_micro_version = Character.digit(cs.charAt(4), 10);
cs = cs.subSequence(5, cs.length());
if (cs.charAt(0) == '_' && cs.length() >= 3 &&
- Character.isDigit(cs.charAt(1)) &&
+ Character.isDigit(cs.charAt(1)) &&
Character.isDigit(cs.charAt(2))) {
int nextChar = 3;
try {
- String uu = cs.subSequence(1, 3).toString();
+ String uu = cs.subSequence(1, 3).toString();
jvm_update_version = Integer.valueOf(uu).intValue();
if (cs.length() >= 4) {
char c = cs.charAt(3);
- if (c >= 'a' && c <= 'z') {
+ if (c >= 'a' && c <= 'z') {
jvm_special_version = Character.toString(c);
nextChar++;
}
@@ -286,14 +307,14 @@ public class Version {
cs = cs.subSequence(1, cs.length());
String[] res = cs.toString().split("-");
for (String s : res) {
- if (s.charAt(0) == 'b' && s.length() == 3 &&
- Character.isDigit(s.charAt(1)) &&
+ if (s.charAt(0) == 'b' && s.length() == 3 &&
+ Character.isDigit(s.charAt(1)) &&
Character.isDigit(s.charAt(2))) {
- jvm_build_number =
+ jvm_build_number =
Integer.valueOf(s.substring(1, 3)).intValue();
break;
- }
- }
+ }
+ }
}
}
}