From: Yoshito Umaoka Date: Tue, 9 Jul 2013 18:28:49 +0000 (+0000) Subject: ICU-10084 Resolve Eclipse compiler warnings. X-Git-Tag: milestone-59-0-1~2784 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b280b62e5c7dfc801f297a8b82ae821526fe46c4;p=icu ICU-10084 Resolve Eclipse compiler warnings. X-SVN-Rev: 33898 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/CompactDecimalFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/CompactDecimalFormat.java index 13a3a3ff826..1ff32828cbe 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/CompactDecimalFormat.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/CompactDecimalFormat.java @@ -54,7 +54,7 @@ public class CompactDecimalFormat extends DecimalFormat { private static final long serialVersionUID = 4716293295276629682L; - private static final int POSITIVE_PREFIX = 0, POSITIVE_SUFFIX = 1, AFFIX_SIZE = 2; +// private static final int POSITIVE_PREFIX = 0, POSITIVE_SUFFIX = 1, AFFIX_SIZE = 2; private static final CompactDecimalDataCache cache = new CompactDecimalDataCache(); private final Map units; @@ -149,12 +149,14 @@ public class CompactDecimalFormat extends DecimalFormat { * overridden by default. * @param formatSymbols * Decimal format symbols, typically from a locale. - * @param prefix - * An array of prefix values, one for each power of 10 from 0 to 14 - * @param suffix - * An array of prefix values, one for each power of 10 from 0 to 14 + * @param style + * compact style. * @param divisor * An array of prefix values, one for each power of 10 from 0 to 14 + * @param pluralAffixes + * A map from plural categories to affixes. + * @param currencyAffixes + * A map from plural categories to currency affixes. * @param debugCreationErrors * A collection of strings for debugging. If null on input, then any errors found will be added to that * collection instead of throwing exceptions. @@ -477,10 +479,10 @@ public class CompactDecimalFormat extends DecimalFormat { /** * Return the NumberInfo for the number, given this formatter's settings. - * @param number - * @return + * @param number The number. + * @return The NumberInfo for the given number. * @internal - * @deprecated + * @deprecated This API is ICU internal only. */ public NumberInfo getNumberInfo(double number) { if (getMaximumFractionDigits() == 0 && !areSignificantDigitsUsed()) { diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/ListFormatter.java b/icu4j/main/classes/core/src/com/ibm/icu/text/ListFormatter.java index ec9aecfa11f..993838a662c 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/ListFormatter.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/ListFormatter.java @@ -161,8 +161,8 @@ final public class ListFormatter { /** * Returns the locale of this object. - * @deprecated * @internal + * @deprecated This API is ICU internal only. */ public ULocale getLocale() { return locale; diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/PluralRules.java b/icu4j/main/classes/core/src/com/ibm/icu/text/PluralRules.java index 7840f372543..addae1e165e 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/text/PluralRules.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/text/PluralRules.java @@ -220,7 +220,7 @@ public class PluralRules implements Serializable { /** * Utility for getting CARDINAL rules. - * @param locale + * @param locale the locale * @return plural rules. * @deprecated This API is ICU internal only. * @internal @@ -1320,6 +1320,7 @@ public class PluralRules implements Serializable { return 37; } + @SuppressWarnings("unused") private boolean addConditional(Set toAddTo, Set others, double trial) { boolean added; NumberInfo toAdd = new NumberInfo(trial); @@ -1444,10 +1445,10 @@ public class PluralRules implements Serializable { /** - * Given a number, returns the keyword of the first rule that applies to + * Given a number information, returns the keyword of the first rule that applies to * the number. * - * @param number The number for which the rule has to be determined. + * @param sample The number information for which the rule has to be determined. * @return The keyword of the selected rule. * @internal * @deprecated This API is ICU internal only. @@ -1970,14 +1971,12 @@ public class PluralRules implements Serializable { throws IOException { throw new NotSerializableException(); } + private void readObject(ObjectInputStream in ) throws IOException, ClassNotFoundException { throw new NotSerializableException(); } - private void readObjectNoData( - ) throws ObjectStreamException { - throw new NotSerializableException(); - } + private Object writeReplace() throws ObjectStreamException { return new PluralRulesSerialProxy(toString()); } diff --git a/icu4j/main/classes/core/src/com/ibm/icu/util/Currency.java b/icu4j/main/classes/core/src/com/ibm/icu/util/Currency.java index a57976d718b..38da761ffe0 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/util/Currency.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/util/Currency.java @@ -711,11 +711,12 @@ public class Currency extends MeasureUnit implements Serializable { this.currencyString = currencyString; } - private String getISOCode() { + public String getISOCode() { return isoCode; } - private String getCurrencyString() { + @SuppressWarnings("unused") + public String getCurrencyString() { return currencyString; } } diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java index cb74cee8596..a87fe99bf9f 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/calendar/CalendarRegression.java @@ -2342,23 +2342,22 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk { public void TestT9968() { SimpleDateFormat sdf0 = new SimpleDateFormat("-MMMM"); ParsePosition pos0 = new ParsePosition(0); - Date d0 = sdf0.parse("-September", pos0); - logln("sdf0: "+pos0.getErrorIndex() + "/" + pos0.getIndex()); + /* Date d0 = */ sdf0.parse("-September", pos0); + logln("sdf0: " + pos0.getErrorIndex() + "/" + pos0.getIndex()); assertTrue("Fail: failed a good test", pos0.getErrorIndex() == -1); SimpleDateFormat sdf1 = new SimpleDateFormat("-MMMM"); ParsePosition pos1 = new ParsePosition(0); - Date d1 = sdf1.parse("-????", pos1); - logln("sdf1: "+pos1.getErrorIndex() + "/" + pos1.getIndex()); + /* Date d1 = */ sdf1.parse("-????", pos1); + logln("sdf1: " + pos1.getErrorIndex() + "/" + pos1.getIndex()); assertTrue("Fail: failed to detect bad parse", pos1.getErrorIndex() == 1); SimpleDateFormat sdf2 = new SimpleDateFormat("MMMM"); ParsePosition pos2 = new ParsePosition(0); - Date d2 = sdf2.parse("????", pos2); - logln("sdf2: "+pos2.getErrorIndex() + "/" + pos2.getIndex()); + /* Date d2 = */ sdf2.parse("????", pos2); + logln("sdf2: " + pos2.getErrorIndex() + "/" + pos2.getIndex()); assertTrue("Fail: failed to detect bad parse", pos2.getErrorIndex() == 0); - - } + } } //eof diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java index 118e224d9f6..3e9f02cd06b 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java @@ -1204,15 +1204,15 @@ public class DateFormatRegressionTest extends com.ibm.icu.dev.test.TestFmwk { public void TestT10110() { try { - SimpleDateFormat formatter = new SimpleDateFormat("Gy年M月d日E", new Locale("zh_Hans")); - Object parsed = formatter.parseObject("610000"); + SimpleDateFormat formatter = new SimpleDateFormat("Gy年M月d日E", new Locale("zh_Hans")); + /* Object parsed = */ formatter.parseObject("610000"); } catch(ParseException pe) { return; } catch(Throwable t) { - errln("ParseException not thrown for bad pattern! exception was: " + t.getLocalizedMessage()); - return; + errln("ParseException not thrown for bad pattern! exception was: " + t.getLocalizedMessage()); + return; } errln("No exception thrown at all for bad pattern!"); } diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/PluralRulesTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/PluralRulesTest.java index d291c8d1c08..b6165fcdffc 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/PluralRulesTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/PluralRulesTest.java @@ -190,7 +190,6 @@ public class PluralRulesTest extends TestFmwk { for (NumberInfo sample : samples) { collisionTest.clear(); for (Entry entry: keywordToRule.entrySet()) { - String keyword = entry.getKey(); PluralRules rule = entry.getValue(); String foundKeyword = rule.select(sample); if (foundKeyword.equals("other")) { @@ -696,8 +695,9 @@ public class PluralRulesTest extends TestFmwk { logln(locale + "\tsize:\t" + size.value); max = Math.max(max, size.value); if (!assertEquals(locale + "\tPlural rules before and after serialization", item, item2)) { + // for debugging PluralRules item3 = serializeAndDeserialize(item, size); - item.equals(item2); + item.equals(item3); } } logln("max \tsize:\t" + max);