7116914: Miscellaneous warnings (sun.text)
authorpeytoia
Tue, 06 Dec 2011 08:39:02 +0900
changeset 11136 f0f53bbe5bd1
parent 11135 fb2447d0a09c
child 11137 d5efdfdf72e0
7116914: Miscellaneous warnings (sun.text) Reviewed-by: smarks, okutsu
jdk/src/share/classes/sun/text/CompactByteArray.java
jdk/src/share/classes/sun/text/IntHashtable.java
jdk/src/share/classes/sun/text/bidi/BidiBase.java
jdk/src/share/classes/sun/text/normalizer/ICUData.java
jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java
jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java
jdk/src/share/classes/sun/text/normalizer/SymbolTable.java
jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java
jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java
jdk/src/share/classes/sun/text/normalizer/VersionInfo.java
--- a/jdk/src/share/classes/sun/text/CompactByteArray.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/CompactByteArray.java	Tue Dec 06 08:39:02 2011 +0900
@@ -264,9 +264,9 @@
     {
         try {
             CompactByteArray other = (CompactByteArray) super.clone();
-            other.values = (byte[])values.clone();
-            other.indices = (short[])indices.clone();
-            if (hashes != null) other.hashes = (int[])hashes.clone();
+            other.values = values.clone();
+            other.indices = indices.clone();
+            if (hashes != null) other.hashes = hashes.clone();
             return other;
         } catch (CloneNotSupportedException e) {
             throw new InternalError(e);
--- a/jdk/src/share/classes/sun/text/IntHashtable.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/IntHashtable.java	Tue Dec 06 08:39:02 2011 +0900
@@ -122,11 +122,11 @@
             // this line just scrambles the bits as each value is added into the
             // has value.  This helps to make sure we affect all the bits and that
             // the same values in a different order will produce a different hash value
-            result = (int)(result * scrambler + 1);
+            result = result * scrambler + 1;
             result += keyList[i];
         }
         for (int i = 0; i < values.length; ++i) {
-            result = (int)(result * scrambler + 1);
+            result = result * scrambler + 1;
             result += values[i];
         }
         return result;
@@ -135,8 +135,8 @@
     public Object clone ()
                     throws CloneNotSupportedException {
         IntHashtable result = (IntHashtable) super.clone();
-        values = (int[]) values.clone();
-        keyList = (int[])keyList.clone();
+        values = values.clone();
+        keyList = keyList.clone();
         return result;
     }
 
--- a/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/bidi/BidiBase.java	Tue Dec 06 08:39:02 2011 +0900
@@ -1106,7 +1106,7 @@
      * Assume sizeNeeded>0.
      * If object != null, then assume size > 0.
      */
-    private Object getMemory(String label, Object array, Class arrayClass,
+    private Object getMemory(String label, Object array, Class<?> arrayClass,
             boolean mayAllocate, int sizeNeeded)
     {
         int len = Array.getLength(array);
@@ -1990,7 +1990,7 @@
         cell = impTab[oldStateSeq][_prop];
         levState.state = GetState(cell);        /* isolate the new state */
         actionSeq = impAct[GetAction(cell)];    /* isolate the action */
-        addLevel = (byte)impTab[levState.state][IMPTABLEVELS_RES];
+        addLevel = impTab[levState.state][IMPTABLEVELS_RES];
 
         if (actionSeq != 0) {
             switch (actionSeq) {
@@ -2014,7 +2014,7 @@
                     /* nothing, just clean up */
                     levState.lastStrongRTL = -1;
                     /* check if we have a pending conditional segment */
-                    level = (byte)impTab[oldStateSeq][IMPTABLEVELS_RES];
+                    level = impTab[oldStateSeq][IMPTABLEVELS_RES];
                     if ((level & 1) != 0 && levState.startON > 0) { /* after ON */
                         start = levState.startON;   /* reset to basic run level */
                     }
@@ -2115,7 +2115,7 @@
                 break;
 
             case 11:                    /* L after L+ON+EN/AN/ON */
-                level = (byte)levState.runLevel;
+                level = levState.runLevel;
                 for (k = start0-1; k >= levState.startON; k--) {
                     if (levels[k] == level+3) {
                         while (levels[k] == level+3) {
@@ -2178,7 +2178,7 @@
         levState.runLevel = levels[start];
         levState.impTab = impTabPair.imptab[levState.runLevel & 1];
         levState.impAct = impTabPair.impact[levState.runLevel & 1];
-        processPropertySeq(levState, (short)sor, start, start);
+        processPropertySeq(levState, sor, start, start);
         /* initialize for property state table */
         if (dirProps[start] == NSM) {
             stateImp = (short)(1 + sor);
@@ -2230,7 +2230,7 @@
             }
         }
         /* flush possible pending sequence, e.g. ON */
-        processPropertySeq(levState, (short)eor, limit, limit);
+        processPropertySeq(levState, eor, limit, limit);
     }
 
     /* perform (L1) and (X9) ---------------------------------------------------- */
@@ -3484,6 +3484,7 @@
             }
         }
 
+        @SuppressWarnings("serial")
         private static AttributedCharacterIterator.Attribute
             getTextAttribute(String name)
         {
--- a/jdk/src/share/classes/sun/text/normalizer/ICUData.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/ICUData.java	Tue Dec 06 08:39:02 2011 +0900
@@ -48,12 +48,12 @@
  */
 public final class ICUData {
 
-    private static InputStream getStream(final Class root, final String resourceName, boolean required) {
+    private static InputStream getStream(final Class<ICUData> root, final String resourceName, boolean required) {
         InputStream i = null;
 
         if (System.getSecurityManager() != null) {
-            i = (InputStream)AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
+            i = AccessController.doPrivileged(new PrivilegedAction<InputStream>() {
+                    public InputStream run() {
                         return root.getResourceAsStream(resourceName);
                     }
                 });
--- a/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/NormalizerBase.java	Tue Dec 06 08:39:02 2011 +0900
@@ -886,6 +886,7 @@
      * @deprecated ICU 3.2
      * @obsolete ICU 3.2
      */
+     @Deprecated
      public int setIndex(int index) {
          setIndexOnly(index);
          return current();
@@ -899,6 +900,7 @@
      * @return The codepoint as an int
      * @see #startIndex
      */
+    @Deprecated
     public int getBeginIndex() {
         return 0;
     }
@@ -911,6 +913,7 @@
      * @return The codepoint as an int
      * @see #endIndex
      */
+    @Deprecated
     public int getEndIndex() {
         return endIndex();
     }
@@ -1235,11 +1238,11 @@
                                                 mode, options);
 
                 if(pNeededToNormalize!=null) {
-                    pNeededToNormalize[0]=(boolean)(destLength!=bufferLength ||
-                                                    Utility.arrayRegionMatches(
-                                                                               buffer,0,dest,
-                                                                               destStart,destLimit
-                                                                               ));
+                    pNeededToNormalize[0]=destLength!=bufferLength ||
+                                          Utility.arrayRegionMatches(
+                                            buffer,0,dest,
+                                            destStart,destLimit
+                                          );
                 }
             } else {
                 /* just copy the source characters */
@@ -1458,10 +1461,10 @@
                                           dest,destStart,destLimit, options);
 
                 if(pNeededToNormalize!=null) {
-                    pNeededToNormalize[0]=(boolean)(destLength!=bufferLength ||
-                                                    Utility.arrayRegionMatches(buffer,startIndex[0],
-                                                                               dest,destStart,
-                                                                               destLength));
+                    pNeededToNormalize[0]=destLength!=bufferLength ||
+                                          Utility.arrayRegionMatches(buffer,startIndex[0],
+                                            dest,destStart,
+                                            destLength);
                 }
             } else {
                 /* just copy the source characters */
--- a/jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/NormalizerImpl.java	Tue Dec 06 08:39:02 2011 +0900
@@ -98,11 +98,11 @@
     private static final int EXTRA_SHIFT=16;
 
     /* norm32 value constants using >16 bits */
-    private static final long  MIN_SPECIAL    =  (long)(0xfc000000 & UNSIGNED_INT_MASK);
-    private static final long  SURROGATES_TOP =  (long)(0xfff00000 & UNSIGNED_INT_MASK);
-    private static final long  MIN_HANGUL     =  (long)(0xfff00000 & UNSIGNED_INT_MASK);
-//  private static final long  MIN_JAMO_V     =  (long)(0xfff20000 & UNSIGNED_INT_MASK);
-    private static final long  JAMO_V_TOP     =  (long)(0xfff30000 & UNSIGNED_INT_MASK);
+    private static final long  MIN_SPECIAL    =  0xfc000000 & UNSIGNED_INT_MASK;
+    private static final long  SURROGATES_TOP =  0xfff00000 & UNSIGNED_INT_MASK;
+    private static final long  MIN_HANGUL     =  0xfff00000 & UNSIGNED_INT_MASK;
+//  private static final long  MIN_JAMO_V     =  0xfff20000 & UNSIGNED_INT_MASK;
+    private static final long  JAMO_V_TOP     =  0xfff30000 & UNSIGNED_INT_MASK;
 
 
     /* indexes[] value names */
@@ -134,7 +134,7 @@
     private static final int AUX_COMP_EX_SHIFT           = 10;
     private static final int AUX_NFC_SKIPPABLE_F_SHIFT = 12;
 
-    private static final int AUX_MAX_FNC          =   ((int)1<<AUX_COMP_EX_SHIFT);
+    private static final int AUX_MAX_FNC          =   1<<AUX_COMP_EX_SHIFT;
     private static final int AUX_UNSAFE_MASK      =   (int)((1<<AUX_UNSAFE_SHIFT) & UNSIGNED_INT_MASK);
     private static final int AUX_FNC_MASK         =   (int)((AUX_MAX_FNC-1) & UNSIGNED_INT_MASK);
     private static final int AUX_COMP_EX_MASK     =   (int)((1<<AUX_COMP_EX_SHIFT) & UNSIGNED_INT_MASK);
@@ -188,7 +188,7 @@
         */
         /* auxTrie: the folding offset is in bits 9..0 of the 16-bit trie result */
         public int getFoldingOffset(int value){
-            return (int)(value &AUX_FNC_MASK)<<SURROGATE_BLOCK_BITS;
+            return (value &AUX_FNC_MASK)<<SURROGATE_BLOCK_BITS;
         }
     }
 
@@ -972,7 +972,7 @@
 
             /* copy these code units all at once */
             if(srcIndex!=prevSrc) {
-                length=(int)(srcIndex-prevSrc);
+                length=srcIndex-prevSrc;
                 if((destIndex+length)<=destLimit) {
                     System.arraycopy(src,prevSrc,dest,destIndex,length);
                 }
@@ -1814,7 +1814,7 @@
 
             /* copy these code units all at once */
             if(srcIndex!=prevSrc) {
-                length=(int)(srcIndex-prevSrc);
+                length=srcIndex-prevSrc;
                 if((destIndex+length)<=destLimit) {
                     System.arraycopy(src,prevSrc,dest,destIndex,length);
                 }
@@ -2022,13 +2022,13 @@
     public static int getCombiningClass(int c) {
         long norm32;
         norm32=getNorm32(c);
-        return (char)((norm32>>CC_SHIFT)&0xFF);
+        return (int)((norm32>>CC_SHIFT)&0xFF);
     }
 
     public static boolean isFullCompositionExclusion(int c) {
         if(isFormatVersion_2_1) {
             int aux =AuxTrieImpl.auxTrie.getCodePointValue(c);
-            return (boolean)((aux & AUX_COMP_EX_MASK)!=0);
+            return (aux & AUX_COMP_EX_MASK)!=0;
         } else {
             return false;
         }
@@ -2037,7 +2037,7 @@
     public static boolean isCanonSafeStart(int c) {
         if(isFormatVersion_2_1) {
             int aux = AuxTrieImpl.auxTrie.getCodePointValue(c);
-            return (boolean)((aux & AUX_UNSAFE_MASK)==0);
+            return (aux & AUX_UNSAFE_MASK)==0;
         } else {
             return false;
         }
@@ -2546,7 +2546,7 @@
 
             // copy these code units all at once
             if (srcIndex != prevSrc) {
-                length = (int)(srcIndex - prevSrc);
+                length = srcIndex - prevSrc;
                 if ((destIndex + length) <= destLimit) {
                     System.arraycopy(src,prevSrc,dest,destIndex,length);
                 }
--- a/jdk/src/share/classes/sun/text/normalizer/SymbolTable.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/SymbolTable.java	Tue Dec 06 08:39:02 2011 +0900
@@ -65,6 +65,7 @@
  * @draft ICU 2.8
  * @deprecated This is a draft API and might change in a future release of ICU.
  */
+@Deprecated
 public interface SymbolTable {
 
     /**
@@ -72,6 +73,7 @@
      * @draft ICU 2.8
      * @deprecated This is a draft API and might change in a future release of ICU.
      */
+    @Deprecated
     static final char SYMBOL_REF = '$';
 
     /**
@@ -84,6 +86,7 @@
      * @draft ICU 2.8
      * @deprecated This is a draft API and might change in a future release of ICU.
      */
+    @Deprecated
     char[] lookup(String s);
 
     /**
@@ -95,6 +98,7 @@
      * @draft ICU 2.8
      * @deprecated This is a draft API and might change in a future release of ICU.
      */
+    @Deprecated
     UnicodeMatcher lookupMatcher(int ch);
 
     /**
@@ -115,5 +119,6 @@
      * @draft ICU 2.8
      * @deprecated This is a draft API and might change in a future release of ICU.
      */
+    @Deprecated
     String parseReference(String text, ParsePosition pos, int limit);
 }
--- a/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/UnicodeSet.java	Tue Dec 06 08:39:02 2011 +0900
@@ -298,7 +298,7 @@
 
     // NOTE: normally the field should be of type SortedSet; but that is missing a public clone!!
     // is not private so that UnicodeSetIterator can get access
-    TreeSet strings = new TreeSet();
+    TreeSet<String> strings = new TreeSet<>();
 
     /**
      * The pattern representation of this set.  This may not be the
@@ -368,7 +368,7 @@
      * @stable ICU 2.0
      */
     public UnicodeSet set(UnicodeSet other) {
-        list = (int[]) other.list.clone();
+        list = other.list.clone();
         len = other.len;
         pat = other.pat;
         strings = (TreeSet)other.strings.clone();
@@ -524,10 +524,10 @@
         }
 
         if (includeStrings && strings.size() > 0) {
-            Iterator it = strings.iterator();
+            Iterator<String> it = strings.iterator();
             while (it.hasNext()) {
                 result.append('{');
-                _appendToPat(result, (String) it.next(), escapeUnprintable);
+                _appendToPat(result, it.next(), escapeUnprintable);
                 result.append('}');
             }
         }
@@ -1180,14 +1180,17 @@
                         }
                     }
                     syntaxError(chars, "'-' not after char or set");
+                    break;
                 case '&':
                     if (lastItem == 2 && op == 0) {
                         op = (char) c;
                         continue;
                     }
                     syntaxError(chars, "'&' not after set");
+                    break;
                 case '^':
                     syntaxError(chars, "'^' not after '['");
+                    break;
                 case '{':
                     if (op != 0) {
                         syntaxError(chars, "Missing operand after operator");
@@ -1251,6 +1254,7 @@
                         continue;
                     }
                     syntaxError(chars, "Unquoted '$'");
+                    break;
                 default:
                     break;
                 }
--- a/jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/UnicodeSetIterator.java	Tue Dec 06 08:39:02 2011 +0900
@@ -154,7 +154,7 @@
 
         if (stringIterator == null) return false;
         codepoint = IS_STRING; // signal that value is actually a string
-        string = (String)stringIterator.next();
+        string = stringIterator.next();
         if (!stringIterator.hasNext()) stringIterator = null;
         return true;
     }
@@ -203,7 +203,7 @@
      * @internal
      */
     protected int nextElement;
-    private Iterator stringIterator = null;
+    private Iterator<String> stringIterator = null;
 
     /**
      * Invariant: stringIterator is null when there are no (more) strings remaining
--- a/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java	Mon Dec 05 10:50:14 2011 -0800
+++ b/jdk/src/share/classes/sun/text/normalizer/VersionInfo.java	Tue Dec 06 08:39:02 2011 +0900
@@ -153,7 +153,7 @@
     /**
      * Map of singletons
      */
-    private static final HashMap MAP_ = new HashMap();
+    private static final HashMap<Integer, Object> MAP_ = new HashMap<>();
     /**
      * Error statement string
      */