/*
*******************************************************************************
- * Copyright (C) 1996-2011, International Business Machines Corporation and *
- * others. All Rights Reserved. *
+ * Copyright (C) 1996-2013, International Business Machines Corporation and
+ * others. All Rights Reserved.
*******************************************************************************
*/
*/
public static final VersionInfo UNICODE_6_0;
+ /**
+ * Unicode 6.1 version
+ * @stable ICU 49
+ */
+ public static final VersionInfo UNICODE_6_1;
+
+ /**
+ * Unicode 6.2 version
+ * @stable ICU 50
+ */
+ public static final VersionInfo UNICODE_6_2;
+
+ /**
+ * Unicode 6.3 version
+ * @stable ICU 52
+ */
+ public static final VersionInfo UNICODE_6_3;
+
/**
* ICU4J current release version
* @stable ICU 2.8
* @internal
* @deprecated This API is ICU internal only.
*/
- public static final String ICU_DATA_VERSION_PATH = "48b";
+ public static final String ICU_DATA_VERSION_PATH = "52b";
/**
* Data version in ICU4J.
throw new IllegalArgumentException(INVALID_VERSION_NUMBER_);
}
int version = getInt(major, minor, milli, micro);
- Integer key = new Integer(version);
+ Integer key = Integer.valueOf(version);
VersionInfo result = MAP_.get(key);
if (result == null) {
result = new VersionInfo(version);
return getInstance(major, 0, 0, 0);
}
- private static VersionInfo javaVersion;
+ private static volatile VersionInfo javaVersion;
/**
* @internal
*/
public static VersionInfo javaVersion() {
if (javaVersion == null) {
- String s = System.getProperty("java.version");
- // clean string
- // preserve only digits, separated by single '.'
- // ignore over 4 digit sequences
- // does not test < 255, very odd...
-
- char[] chars = s.toCharArray();
- int r = 0, w = 0, count = 0;
- boolean numeric = false; // ignore leading non-numerics
- while (r < chars.length) {
- char c = chars[r++];
- if (c < '0' || c > '9') {
- if (numeric) {
- if (count == 3) {
- // only four digit strings allowed
- break;
+ synchronized(VersionInfo.class) {
+ if (javaVersion == null) {
+ String s = System.getProperty("java.version");
+ // clean string
+ // preserve only digits, separated by single '.'
+ // ignore over 4 digit sequences
+ // does not test < 255, very odd...
+
+ char[] chars = s.toCharArray();
+ int r = 0, w = 0, count = 0;
+ boolean numeric = false; // ignore leading non-numerics
+ while (r < chars.length) {
+ char c = chars[r++];
+ if (c < '0' || c > '9') {
+ if (numeric) {
+ if (count == 3) {
+ // only four digit strings allowed
+ break;
+ }
+ numeric = false;
+ chars[w++] = '.';
+ ++count;
+ }
+ } else {
+ numeric = true;
+ chars[w++] = c;
}
- numeric = false;
- chars[w++] = '.';
- ++count;
}
- } else {
- numeric = true;
- chars[w++] = c;
- }
- }
- while (w > 0 && chars[w-1] == '.') {
- --w;
- }
+ while (w > 0 && chars[w-1] == '.') {
+ --w;
+ }
- String vs = new String(chars, 0, w);
+ String vs = new String(chars, 0, w);
- javaVersion = VersionInfo.getInstance(vs);
+ javaVersion = VersionInfo.getInstance(vs);
+ }
+ }
}
return javaVersion;
}
UNICODE_5_1 = getInstance(5, 1, 0, 0);
UNICODE_5_2 = getInstance(5, 2, 0, 0);
UNICODE_6_0 = getInstance(6, 0, 0, 0);
+ UNICODE_6_1 = getInstance(6, 1, 0, 0);
+ UNICODE_6_2 = getInstance(6, 2, 0, 0);
+ UNICODE_6_3 = getInstance(6, 3, 0, 0);
- ICU_VERSION = getInstance(4, 8, 1, 1);
- ICU_DATA_VERSION = getInstance(4, 8, 1, 0);
- UNICODE_VERSION = UNICODE_6_0;
+ ICU_VERSION = getInstance(52, 1, 0, 0);
+ ICU_DATA_VERSION = getInstance(52, 1, 0, 0);
+ UNICODE_VERSION = UNICODE_6_3;
UCOL_RUNTIME_VERSION = getInstance(7);
UCOL_BUILDER_VERSION = getInstance(8);
/**
* Gets the int from the version numbers
* @param major non-negative version number
- * @param minor non-negativeversion number
- * @param milli non-negativeversion number
- * @param micro non-negativeversion number
+ * @param minor non-negative version number
+ * @param milli non-negative version number
+ * @param micro non-negative version number
*/
private static int getInt(int major, int minor, int milli, int micro)
{
/**
* Main method prints out ICU version information
* @param args arguments (currently not used)
- * @draft ICU 4.6
- * @provisional This API might change or be removed in a future release.
+ * @stable ICU 4.6
*/
public static void main(String[] args) {
String icuApiVer;
- if (ICU_VERSION.getMinor() % 2 != 0) {
- // Development mile stone
- int major = ICU_VERSION.getMajor();
- int minor = ICU_VERSION.getMinor() + 1;
- if (minor >= 10) {
- minor -= 10;
- major++;
+ if (ICU_VERSION.getMajor() <= 4) {
+ if (ICU_VERSION.getMinor() % 2 != 0) {
+ // Development mile stone
+ int major = ICU_VERSION.getMajor();
+ int minor = ICU_VERSION.getMinor() + 1;
+ if (minor >= 10) {
+ minor -= 10;
+ major++;
+ }
+ icuApiVer = "" + major + "." + minor + "M" + ICU_VERSION.getMilli();
+ } else {
+ icuApiVer = ICU_VERSION.getVersionString(2, 2);
}
- icuApiVer = "" + major + "." + minor + "M" + ICU_VERSION.getMilli();
} else {
- icuApiVer = ICU_VERSION.getVersionString(2, 2);
+ if (ICU_VERSION.getMinor() == 0) {
+ // Development mile stone
+ icuApiVer = "" + ICU_VERSION.getMajor() + "M" + ICU_VERSION.getMilli();
+ } else {
+ icuApiVer = ICU_VERSION.getVersionString(2, 2);
+ }
}
- System.out.println("International Component for Unicode for Java " + icuApiVer);
+
+ System.out.println("International Components for Unicode for Java " + icuApiVer);
System.out.println("");
System.out.println("Implementation Version: " + ICU_VERSION.getVersionString(2, 4));