зеркало из https://github.com/mono/ikvm-fork.git
Merged sun.misc.Version changes.
This commit is contained in:
Родитель
53c76ac3c9
Коммит
76882b1550
|
@ -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;
|
||||
|
@ -74,16 +71,39 @@ public class Version {
|
|||
print(System.err);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче