7116914: Miscellaneous warnings (sun.text)

Reviewed-by: smarks, okutsu
This commit is contained in:
Yuka Kamiya 2011-12-06 08:39:02 +09:00
parent 4744f6dd1d
commit 8c1b558a38
10 changed files with 58 additions and 45 deletions

@ -264,9 +264,9 @@ public final class CompactByteArray implements Cloneable {
{
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);

@ -122,11 +122,11 @@ public final class IntHashtable {
// 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 final class IntHashtable {
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;
}

@ -1106,7 +1106,7 @@ public class BidiBase {
* 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 @@ public class BidiBase {
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 @@ public class BidiBase {
/* 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 @@ public class BidiBase {
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 @@ public class BidiBase {
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 @@ public class BidiBase {
}
}
/* 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 @@ public class BidiBase {
}
}
@SuppressWarnings("serial")
private static AttributedCharacterIterator.Attribute
getTextAttribute(String name)
{

@ -48,12 +48,12 @@ import java.util.MissingResourceException;
*/
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);
}
});

@ -886,6 +886,7 @@ public final class NormalizerBase implements Cloneable {
* @deprecated ICU 3.2
* @obsolete ICU 3.2
*/
@Deprecated
public int setIndex(int index) {
setIndexOnly(index);
return current();
@ -899,6 +900,7 @@ public final class NormalizerBase implements Cloneable {
* @return The codepoint as an int
* @see #startIndex
*/
@Deprecated
public int getBeginIndex() {
return 0;
}
@ -911,6 +913,7 @@ public final class NormalizerBase implements Cloneable {
* @return The codepoint as an int
* @see #endIndex
*/
@Deprecated
public int getEndIndex() {
return endIndex();
}
@ -1235,11 +1238,11 @@ public final class NormalizerBase implements Cloneable {
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 @@ public final class NormalizerBase implements Cloneable {
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 */

@ -98,11 +98,11 @@ public final class NormalizerImpl {
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 @@ public final class NormalizerImpl {
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 @@ public final class NormalizerImpl {
*/
/* 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 @@ public final class NormalizerImpl {
/* 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 @@ public final class NormalizerImpl {
/* 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 final class NormalizerImpl {
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 final class NormalizerImpl {
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 @@ public final class NormalizerImpl {
// 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);
}

@ -65,6 +65,7 @@ import java.text.ParsePosition;
* @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 @@ public interface SymbolTable {
* @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 @@ public interface SymbolTable {
* @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 @@ public interface SymbolTable {
* @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 @@ public interface SymbolTable {
* @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);
}

@ -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!!
// 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 @@ public class UnicodeSet implements UnicodeMatcher {
* @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 @@ public class UnicodeSet implements UnicodeMatcher {
}
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 @@ public class UnicodeSet implements UnicodeMatcher {
}
}
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 @@ public class UnicodeSet implements UnicodeMatcher {
continue;
}
syntaxError(chars, "Unquoted '$'");
break;
default:
break;
}

@ -154,7 +154,7 @@ public class UnicodeSetIterator {
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 @@ public class UnicodeSetIterator {
* @internal
*/
protected int nextElement;
private Iterator stringIterator = null;
private Iterator<String> stringIterator = null;
/**
* Invariant: stringIterator is null when there are no (more) strings remaining

@ -153,7 +153,7 @@ public final class VersionInfo
/**
* Map of singletons
*/
private static final HashMap MAP_ = new HashMap();
private static final HashMap<Integer, Object> MAP_ = new HashMap<>();
/**
* Error statement string
*/