ICU-7027 Fixed a bunch of Eclipse compiler warnings.

X-SVN-Rev: 26495
This commit is contained in:
Yoshito Umaoka 2009-08-13 20:32:55 +00:00
parent ee2de03dc2
commit c3a6b83ddb
29 changed files with 107 additions and 152 deletions

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2008, International Business Machines Corporation and *
* Copyright (C) 2008-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -72,7 +72,8 @@ class CharsetISCII extends CharsetICU {
static final short MALAYALAM = KANNADA + 1;
static final short DELTA = 0x80;
}
@SuppressWarnings("unused")
private static final class ISCIILang {
static final short DEF = 0x40;
static final short RMN = 0x41;
@ -120,6 +121,7 @@ class CharsetISCII extends CharsetICU {
short defMaskToUnicode; /* mask for default state in toUnicode */
boolean isFirstBuffer; /* boolean for fromUnicode to see if we need to announce the first script */
boolean resetToDefaultToUnicode; /* boolean for reseting to default delta and mask when a newline is encountered */
@SuppressWarnings("unused")
String name;
int prevToUnicodeStatus; /* Hold the previous toUnicodeStatus. This is necessary because we may need to know the last two code points. */

View file

@ -341,6 +341,7 @@ class CharsetISO2022 extends CharsetICU {
CharsetEncoderMBCS currentEncoder;
CharsetDecoderMBCS currentDecoder;
CharsetMBCS currentConverter;
@SuppressWarnings("unused")
int currentType; // Cnv2022Type;
ISO2022State toU2022State;
ISO2022State fromU2022State;

View file

@ -119,6 +119,7 @@ class CharsetSCSU extends CharsetICU{
short toUState;
byte toUQuoteWindow, toUDynamicWindow;
short toUByteOne;
@SuppressWarnings("unused")
short toUPadding[];
/* state machine state - fromUnicode */

View file

@ -687,6 +687,7 @@ final class CollationParsedRuleBuilder {
// private inner classes -------------------------------------------------
@SuppressWarnings("unused")
private static class CEGenerator {
// package private data members --------------------------------------
@ -908,6 +909,7 @@ final class CollationParsedRuleBuilder {
/**
* size of cPoints.
*/
@SuppressWarnings("unused")
int size;
// constructor
@ -949,6 +951,7 @@ final class CollationParsedRuleBuilder {
* @return combining mark codepoint or 0 if no combining make with class
* value cClass
*/
@SuppressWarnings("unused")
char GetFirstCM(int cClass) {
curClass = cClass;
if (cPoints == null || cClass == 0
@ -963,6 +966,7 @@ final class CollationParsedRuleBuilder {
* Get next CM(combining mark) with the combining class value cClass.
* Return combining mark codepoint or 0 if no next CM.
*/
@SuppressWarnings("unused")
char GetNextCM() {
if (cPoints == null
|| index[curClass] == (index[curClass - 1] + pos)) {

View file

@ -140,6 +140,7 @@ public class RbnfScannerProviderImpl implements RbnfLenientScannerProvider {
///CLOVER:OFF
// The following method contains the same signature as findText
// and has never been used by anything once.
@SuppressWarnings("unused")
public int[] findText2(String str, String key, int startingAt) {
CollationElementIterator strIter = collator.getCollationElementIterator(str);

View file

@ -1199,21 +1199,20 @@ public final class RuleBasedCollator extends Collator
}
}
}
if (Arrays.equals(m_contractionCE_, other.m_contractionCE_)
&& Arrays.equals(m_contractionEnd_, other.m_contractionEnd_)
&& Arrays.equals(m_contractionIndex_, other.m_contractionIndex_)
&& Arrays.equals(m_expansion_, other.m_expansion_)
&& Arrays.equals(m_expansionEndCE_, other.m_expansionEndCE_)) {
// not comparing paddings
for (int i = 0; i < m_expansionEndCE_.length; i ++) {
if (m_expansionEndCEMaxSize_[i]
!= other.m_expansionEndCEMaxSize_[i]) {
return false;
}
return true;
}
if (!Arrays.equals(m_contractionCE_, other.m_contractionCE_)
|| !Arrays.equals(m_contractionEnd_, other.m_contractionEnd_)
|| !Arrays.equals(m_contractionIndex_, other.m_contractionIndex_)
|| !Arrays.equals(m_expansion_, other.m_expansion_)
|| !Arrays.equals(m_expansionEndCE_, other.m_expansionEndCE_)) {
return false;
}
return false;
// not comparing paddings
for (int i = 0; i < m_expansionEndCE_.length; i++) {
if (m_expansionEndCEMaxSize_[i] != other.m_expansionEndCEMaxSize_[i]) {
return false;
}
}
return true;
}
/**

View file

@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2008, International Business Machines Corporation and *
* Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
@ -62,6 +62,7 @@ public class CharTrie extends Trie
* have associated supplementary data
* @param dataManipulate object which provides methods to parse the char data
*/
@SuppressWarnings("all") // No way to ignore dead code warning specifically - see eclipse bug#282770
public CharTrie(int initialValue, int leadUnitValue, DataManipulate dataManipulate) {
super(new char[BMP_INDEX_LENGTH+SURROGATE_BLOCK_COUNT], HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_, dataManipulate);

View file

@ -1,6 +1,6 @@
/*
**********************************************************************
* Copyright (c) 2002-2006, International Business Machines
* Copyright (c) 2002-2009, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
@ -54,6 +54,5 @@ class ICUBinaryStream extends DataInputStream {
throw new IllegalStateException("Skip(" + offset + ") only skipped " +
actual + " bytes");
}
if (false) System.out.println("(seek " + offset + ")");
}
}

View file

@ -1,6 +1,6 @@
/*
******************************************************************************
* Copyright (C) 1996-2008, International Business Machines Corporation and *
* Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
******************************************************************************
*/
@ -57,6 +57,7 @@ public class IntTrie extends Trie
* have associated supplementary data
* @param dataManipulate object which provides methods to parse the char data
*/
@SuppressWarnings("all") // No way to ignore dead code warning specifically - see eclipse bug#282770
public IntTrie(int initialValue, int leadUnitValue, DataManipulate dataManipulate) {
super(new char[BMP_INDEX_LENGTH+SURROGATE_BLOCK_COUNT], HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_, dataManipulate);

View file

@ -180,7 +180,7 @@ public final class Utility {
/**
* Convenience utility. Does null checks on objects, then calls compare.
*/
public static <T> int checkCompare(Comparable a, Comparable b) {
public static <T extends Comparable<T>> int checkCompare(T a, T b) {
return a == null ?
b == null ? 0 : -1 :
b == null ? 1 : a.compareTo(b);

View file

@ -3,7 +3,7 @@
package com.ibm.icu.math;
import java.math.BigInteger;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.lang.UCharacter;
/* ------------------------------------------------------------------ */

View file

@ -1274,8 +1274,8 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
if (id.equals(skeleton)) {
return true; // fast path
}
List parser1 = fp.set(id).getItems();
List parser2 = fp.set(skeleton).getItems();
List<Object> parser1 = fp.set(id).getItems();
List<Object> parser2 = fp.set(skeleton).getItems();
if (parser1.size() != parser2.size()) {
return false;
}
@ -1742,6 +1742,7 @@ public class DateTimePatternGenerator implements Freezable, Cloneable {
/**
*
*/
@SuppressWarnings("unused")
void extractFrom(DateTimeMatcher source, int fieldMask) {
for (int i = 0; i < type.length; ++i) {
if ((fieldMask & (1<<i)) != 0) {

View file

@ -5304,10 +5304,6 @@ public class DecimalFormat extends NumberFormat {
private String posSuffixPatternForCurrency = null;
private int patternType;
public AffixForCurrency() {
patternType = Currency.SYMBOL_NAME;
}
public AffixForCurrency(String negPrefix, String negSuffix, String posPrefix, String posSuffix, int type) {
negPrefixPatternForCurrency = negPrefix;
negSuffixPatternForCurrency = negSuffix;

View file

@ -555,10 +555,12 @@ public class PluralRules implements Serializable {
this.constraint = constraint;
}
@SuppressWarnings("unused")
public Rule and(Constraint c) {
return new ConstrainedRule(keyword, new AndConstraint(constraint, c));
}
@SuppressWarnings("unused")
public Rule or(Constraint c) {
return new ConstrainedRule(keyword, new OrConstraint(constraint, c));
}

View file

@ -6,8 +6,6 @@
*/
package com.ibm.icu.text;
import com.ibm.icu.impl.Utility;
/**
* <code>ReplaceableString</code> is an adapter class that implements the
* <code>Replaceable</code> API around an ordinary <code>StringBuffer</code>.

View file

@ -12,14 +12,12 @@ import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Locale;
import java.util.Map;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.TreeSet;
import java.util.Vector;
import com.ibm.icu.impl.ICUCache;
import com.ibm.icu.impl.ICUResourceBundle;

View file

@ -5309,7 +5309,7 @@ public class TestCharset extends TestFmwk {
CharBuffer monkeyCB = CharBuffer.wrap(monkeyIn);
try {
ByteBuffer monkeyBB = encode.encode(monkeyCB);
CharBuffer monkeyEndResult = decode.decode(monkeyBB);
/* CharBuffer monkeyEndResult =*/ decode.decode(monkeyBB);
} catch (Exception ex) {
errln("Exception thrown while encoding/decoding monkey test in SCSU: " + ex);

View file

@ -857,7 +857,7 @@ public class TestConversion extends ModuleTest {
.getString();
int which = ((ICUResourceBundle) testcase.getObject("which")).getInt(); // only checking for ROUNDTRIP_SET
cc.which = ((ICUResourceBundle) testcase.getObject("which")).getInt(); // only checking for ROUNDTRIP_SET
// ----for debugging only
logln("");
@ -882,7 +882,7 @@ public class TestConversion extends ModuleTest {
return;
}
if(which==1){
if(cc.which==1){
logln("Fallback set not supported at this point for converter : "+charset.displayName());
return;
}
@ -897,7 +897,7 @@ public class TestConversion extends ModuleTest {
mapset.applyPattern(cc.map,false);
mapnotset.applyPattern(cc.mapnot,false);
charset.getUnicodeSet(unicodeset, which);
charset.getUnicodeSet(unicodeset, cc.which);
UnicodeSet diffset = new UnicodeSet();
//are there items that must be in unicodeset but are not?

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2000-2008, International Business Machines Corporation and *
* Copyright (C) 2000-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -1308,10 +1308,6 @@ public class SearchTest extends TestFmwk {
errln("Fail: an extremely large pattern will fail the initialization");
return;
}
if (result != result) {
errln("Error: string search object expected to match itself");
}
}
public void TestNormCanonical() {

View file

@ -6,32 +6,16 @@
*/
package com.ibm.icu.dev.test.util;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.util.Enumeration;
import java.util.MissingResourceException;
import java.util.jar.JarEntry;
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.impl.ICUResourceBundle;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.text.Collator;
import com.ibm.icu.text.UTF16;
import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.Holiday;
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;
import com.ibm.icu.util.UResourceTypeMismatchException;
public final class ICUResourceBundleCollationTest extends TestFmwk {
private static final ClassLoader testLoader = ICUResourceBundleCollationTest.class.getClassLoader();
private static final String COLLATION_RESNAME = "collations";
private static final String COLLATION_KEYWORD = "collation";
private static final String DEFAULT_NAME = "default";

View file

@ -9,10 +9,8 @@ package com.ibm.icu.dev.test.util;
import java.util.HashMap;
import com.ibm.icu.impl.ICUResourceBundle;
import com.ibm.icu.text.Collator;
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;
public class LocaleAliasCollationTest extends com.ibm.icu.dev.test.TestFmwk {
private static final ULocale[][] _LOCALES = {

View file

@ -12,28 +12,11 @@ package com.ibm.icu.dev.test.util;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Locale;
import java.util.TreeMap;
import com.ibm.icu.dev.test.TestFmwk;
import com.ibm.icu.lang.UCharacter;
import com.ibm.icu.text.BreakIterator;
import com.ibm.icu.text.Collator;
import com.ibm.icu.text.DateFormat;
import com.ibm.icu.text.DecimalFormat;
import com.ibm.icu.text.NumberFormat;
import com.ibm.icu.text.SimpleDateFormat;
import com.ibm.icu.text.NumberFormat.SimpleNumberFormatFactory;
import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.IllformedLocaleException;
import com.ibm.icu.util.LocaleData;
import com.ibm.icu.util.ULocale;
import com.ibm.icu.util.UResourceBundle;
import com.ibm.icu.util.VersionInfo;
import com.ibm.icu.util.ULocale.Builder;
public class ULocaleCollationTest extends TestFmwk {

View file

@ -1266,9 +1266,6 @@ public class NumberFormatTest extends com.ibm.icu.dev.test.TestFmwk {
NumberFormat fmt3 = NumberFormat.getInstance(loc3);
NumberFormat fmt4 = NumberFormat.getInstance(loc4);
NumberFormat fmt5 = NumberFormat.getInstance(loc3);
fmt5 = NumberFormat.getInstance(loc3);
expect2(fmt1,1234.567,"\u0e51,\u0e52\u0e53\u0e54.\u0e55\u0e56\u0e57");
expect3(fmt2,5678.0,"\u05d4\u05f3\u05ea\u05e8\u05e2\u05f4\u05d7");
expect2(fmt3,1234.567,"\u06f1,\u06f2\u06f3\u06f4.\u06f5\u06f6\u06f7");

View file

@ -1787,67 +1787,69 @@ public class UnicodeSetTest extends TestFmwk {
}
}
// String[] prettyData = {
// "[\\uD7DE-\\uD90C \\uDCB5-\\uDD9F]", // special case
// "[:any:]",
// "[:whitespace:]",
// "[:linebreak=AL:]",
// };
// Following cod block is commented out to eliminate PrettyPrinter depenencies
// public void TestPrettyPrinting() {
// try{
// PrettyPrinter pp = new PrettyPrinter();
// int i = 0;
// for (; i < prettyData.length; ++i) {
// UnicodeSet test = new UnicodeSet(prettyData[i]);
// checkPrettySet(pp, i, test);
// }
// Random random = new Random(0);
// UnicodeSet test = new UnicodeSet();
// // To keep runtimes under control, make the number of random test cases
// // to try depends on the test framework exhaustive setting.
// // params.inclusions = 5: default exhaustive value
// // params.inclusions = 10: max exhaustive value.
// int iterations = 50;
// if (params.inclusion > 5) {
// iterations = (params.inclusion-5) * 200;
// }
// for (; i < iterations; ++i) {
// double start = random.nextGaussian() * 0x10000;
// if (start < 0) start = - start;
// if (start > 0x10FFFF) {
// start = 0x10FFFF;
// }
// double end = random.nextGaussian() * 0x100;
// if (end < 0) end = -end;
// end = start + end;
// if (end > 0x10FFFF) {
// end = 0x10FFFF;
// }
// test.complement((int)start, (int)end);
// checkPrettySet(pp, i, test);
// }
// }catch(RuntimeException ex){
// warnln("Could not load Collator");
// }
// }
// private void checkPrettySet(PrettyPrinter pp, int i, UnicodeSet test) {
// String pretty = pp.toPattern(test);
// UnicodeSet retry = new UnicodeSet(pretty);
// if (!test.equals(retry)) {
// errln(i + ". Failed test: " + test + " != " + pretty);
// } else {
// logln(i + ". Worked for " + truncate(test.toString()) + " => " + truncate(pretty));
// }
// }
private String truncate(String string) {
if (string.length() <= 100) return string;
return string.substring(0,97) + "...";
}
// String[] prettyData = {
// "[\\uD7DE-\\uD90C \\uDCB5-\\uDD9F]", // special case
// "[:any:]",
// "[:whitespace:]",
// "[:linebreak=AL:]",
// };
//
// public void TestPrettyPrinting() {
// try{
// PrettyPrinter pp = new PrettyPrinter();
//
// int i = 0;
// for (; i < prettyData.length; ++i) {
// UnicodeSet test = new UnicodeSet(prettyData[i]);
// checkPrettySet(pp, i, test);
// }
// Random random = new Random(0);
// UnicodeSet test = new UnicodeSet();
//
// // To keep runtimes under control, make the number of random test cases
// // to try depends on the test framework exhaustive setting.
// // params.inclusions = 5: default exhaustive value
// // params.inclusions = 10: max exhaustive value.
// int iterations = 50;
// if (params.inclusion > 5) {
// iterations = (params.inclusion-5) * 200;
// }
// for (; i < iterations; ++i) {
// double start = random.nextGaussian() * 0x10000;
// if (start < 0) start = - start;
// if (start > 0x10FFFF) {
// start = 0x10FFFF;
// }
// double end = random.nextGaussian() * 0x100;
// if (end < 0) end = -end;
// end = start + end;
// if (end > 0x10FFFF) {
// end = 0x10FFFF;
// }
// test.complement((int)start, (int)end);
// checkPrettySet(pp, i, test);
// }
// }catch(RuntimeException ex){
// warnln("Could not load Collator");
// }
// }
//
// private void checkPrettySet(PrettyPrinter pp, int i, UnicodeSet test) {
// String pretty = pp.toPattern(test);
// UnicodeSet retry = new UnicodeSet(pretty);
// if (!test.equals(retry)) {
// errln(i + ". Failed test: " + test + " != " + pretty);
// } else {
// logln(i + ". Worked for " + truncate(test.toString()) + " => " + truncate(pretty));
// }
// }
//
// private String truncate(String string) {
// if (string.length() <= 100) return string;
// return string.substring(0,97) + "...";
// }
public class TokenSymbolTable implements SymbolTable {
HashMap contents = new HashMap();

View file

@ -651,7 +651,6 @@ public final class ICUResourceBundleTest extends TestFmwk {
}
*/
ICUResourceBundle bundle = null;
String key = null;
bundle = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME,"fr_FR");
ICUResourceBundle b1 = bundle.getWithFallback("calendar");
@ -670,8 +669,6 @@ public final class ICUResourceBundleTest extends TestFmwk {
}
}
private static final String DEFAULT_NAME = "default";
private static final String STANDARD_NAME = "standard";
private static final String CALENDAR_RESNAME = "calendar";
private static final String CALENDAR_KEYWORD = "calendar";

View file

@ -6,13 +6,9 @@
*/
package com.ibm.icu.dev.test.translit;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.SortedMap;

View file

@ -552,6 +552,7 @@ public class BagFormatter {
doAt(c);
}
@SuppressWarnings("unused")
public String format(Object o) {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
@ -695,12 +696,10 @@ public class BagFormatter {
private static class NameIterator {
String source;
int position;
int start;
int limit;
NameIterator(String source) {
this.source = source;
this.start = 0;
this.limit = source.length();
}
/**

View file

@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (C) 2002-2008, International Business Machines Corporation and *
* Copyright (C) 2002-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -568,9 +568,10 @@ abstract public class Pick {
}
}
@SuppressWarnings("unused")
private abstract static class ListPick extends Pick {
protected Pick[] items = new Pick[0];
Pick simplify() {
if (items.length > 1) return this;
if (items.length == 1) return items[0];

View file

@ -10,7 +10,6 @@ package com.ibm.icu.dev.test.util;
import java.util.Comparator;
import java.util.TreeSet;
import com.ibm.icu.impl.MultiComparator;
import com.ibm.icu.impl.Utility;
import com.ibm.icu.lang.UCharacter;
import com.ibm.icu.text.StringTransform;
@ -153,7 +152,6 @@ public class PrettyPrinter {
}
private PrettyPrinter appendUnicodeSetItem(String s) {
int cp;
if (UTF16.hasMoreCodePointsThan(s, 1)) {
flushLast();
addSpaceAsNeededBefore(s);