提交 5edbe417 编写于 作者: P peytoia

7116914: Miscellaneous warnings (sun.text)

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