]> gitweb.fperrin.net Git - Dictionary.git/blobdiff - jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/util/VersionInfo.java
Upgrade ICU4J.
[Dictionary.git] / jars / icu4j-52_1 / main / classes / core / src / com / ibm / icu / util / VersionInfo.java
similarity index 82%
rename from jars/icu4j-4_8_1_1/main/classes/core/src/com/ibm/icu/util/VersionInfo.java
rename to jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/util/VersionInfo.java
index 314eb0dfeffb4d8c19b8383139f934f9c00ece6c..631b8ef07bca46aad40cafb734c4dc00314fe1a9 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *******************************************************************************
- * 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.
  *******************************************************************************
  */
 
@@ -131,6 +131,24 @@ public final class VersionInfo implements Comparable<VersionInfo>
      */
     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
@@ -143,7 +161,7 @@ public final class VersionInfo implements Comparable<VersionInfo>
      * @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.
@@ -246,7 +264,7 @@ public final class VersionInfo implements Comparable<VersionInfo>
             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);
@@ -300,7 +318,7 @@ public final class VersionInfo implements Comparable<VersionInfo>
         return getInstance(major, 0, 0, 0);
     }
 
-    private static VersionInfo javaVersion;
+    private static volatile VersionInfo javaVersion;
 
     /**
      * @internal
@@ -308,39 +326,43 @@ public final class VersionInfo implements Comparable<VersionInfo>
      */
     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;
     }
@@ -487,10 +509,13 @@ public final class VersionInfo implements Comparable<VersionInfo>
         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);
@@ -511,9 +536,9 @@ public final class VersionInfo implements Comparable<VersionInfo>
     /**
      * 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)
     {
@@ -523,26 +548,35 @@ public final class VersionInfo implements Comparable<VersionInfo>
     /**
      * 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));