diff --git a/icu4j/main/charset/src/test/java/com/ibm/icu/dev/test/charset/TestCharset.java b/icu4j/main/charset/src/test/java/com/ibm/icu/dev/test/charset/TestCharset.java index 80e245bcfbd..f42a9f87a37 100644 --- a/icu4j/main/charset/src/test/java/com/ibm/icu/dev/test/charset/TestCharset.java +++ b/icu4j/main/charset/src/test/java/com/ibm/icu/dev/test/charset/TestCharset.java @@ -926,16 +926,16 @@ public class TestCharset extends TestFmwk { // offsets.put(0); // offsets.put(1); // char[] buffer = null; -// Integer length = new Integer(2); -// Integer cp = new Integer(0); +// Integer length = 2; +// Integer cp = 0; // CoderResult unmap = CoderResult.unmappableForLength(2); // CoderResult malf = CoderResult.malformedForLength(2); // CoderResult under = CoderResult.UNDERFLOW; // // // set up error arrays -// Integer invalidCharLength = new Integer(1); -// Byte subChar1 = new Byte((byte)0); -// Byte subChar1_alternate = new Byte((byte)1); // for TO_U_CALLBACK_SUBSTITUTE +// Integer invalidCharLength = 1; +// Byte subChar1 = (byte)0; +// Byte subChar1_alternate = (byte)1; // for TO_U_CALLBACK_SUBSTITUTE // // // set up chars and bytes backups and expected values for certain cases // CharBuffer charsBackup = bufferCopy(chars); @@ -961,14 +961,14 @@ public class TestCharset extends TestFmwk { // // run toUWriteUChars with normal data // Method toUWriteUChars = CharsetDecoderICU.class.getDeclaredMethod("toUWriteUChars", new Class[] { CharsetDecoderICU.class, char[].class, int.class, int.class, CharBuffer.class, IntBuffer.class, int.class}); // toUWriteUChars.setAccessible(true); -// CoderResult decoderResultExpected1 = (CoderResult)toUWriteUChars.invoke(decoder, new Object[] {decoder, new char[] {0xFFFD}, new Integer(0), new Integer(1), decoderCharsExpected1, decoderOffsetsExpected1, new Integer(bytes.position())}); +// CoderResult decoderResultExpected1 = (CoderResult)toUWriteUChars.invoke(decoder, new Object[] {decoder, new char[] {0xFFFD}, Integer.valueOf(0), Integer.valueOf(1), decoderCharsExpected1, decoderOffsetsExpected1, Integer.valueOf(bytes.position())}); // // // reset certain fields // setFieldValue(CharsetDecoderICU.class, "invalidCharLength", decoder, invalidCharLength); // setFieldValue(CharsetICU.class, "subChar1", ((CharsetICU) decoder.charset()), subChar1_alternate); // // // run toUWriteUChars again -// CoderResult decoderResultExpected2 = (CoderResult)toUWriteUChars.invoke(decoder, new Object[] {decoder, new char[] {0x1A}, new Integer(0), new Integer(1), decoderCharsExpected2, decoderOffsetsExpected2, new Integer(bytes.position())}); +// CoderResult decoderResultExpected2 = (CoderResult)toUWriteUChars.invoke(decoder, new Object[] {decoder, new char[] {0x1A}, Integer.valueOf(0), Integer.valueOf(1), decoderCharsExpected2, decoderOffsetsExpected2, Integer.valueOf(bytes.position())}); // // // begin creating the tests array // ArrayList tests = new ArrayList(); diff --git a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/AlphabeticIndexTest.java b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/AlphabeticIndexTest.java index 5af79f565e5..99aa101733b 100644 --- a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/AlphabeticIndexTest.java +++ b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/AlphabeticIndexTest.java @@ -993,7 +993,7 @@ public class AlphabeticIndexTest extends TestFmwk { List labels = index.getBucketLabels(); for (String[] testCase : testCases) { String name = testCase[0]; - int bucketIndex = Integer.valueOf(testCase[1]); + int bucketIndex = Integer.parseInt(testCase[1]); String label = testCase[2]; String msg = "getBucketIndex(" + name + ")"; assertEquals(msg, bucketIndex, index.getBucketIndex(name)); diff --git a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationMiscTest.java b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationMiscTest.java index be857bfb657..f8ef4f98218 100644 --- a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationMiscTest.java +++ b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationMiscTest.java @@ -530,11 +530,10 @@ public class CollationMiscTest extends TestFmwk { }; String[] att = { "strength", }; - Object[] val = { new Integer(Collator.QUATERNARY), }; + Object[] val = { Collator.QUATERNARY, }; String[] attShifted = { "strength", "AlternateHandling"}; - Object valShifted[] = { new Integer(Collator.QUATERNARY), - Boolean.TRUE }; + Object valShifted[] = { Collator.QUATERNARY, Boolean.TRUE }; genericLocaleStarterWithOptions(Locale.JAPANESE, test1, att, val); genericLocaleStarterWithOptions(Locale.JAPANESE, test2, att, val); @@ -2210,7 +2209,7 @@ public class CollationMiscTest extends TestFmwk { { String tests[] = { "B", "b", "Bb", "bB" }; String[] att = { "strength", "UpperFirst" }; - Object attVals[] = { new Integer(Collator.QUATERNARY), Boolean.TRUE }; + Object attVals[] = { Collator.QUATERNARY, Boolean.TRUE }; genericLocaleStarterWithOptions(new Locale("root","",""), tests, att, attVals); } @@ -2219,7 +2218,7 @@ public class CollationMiscTest extends TestFmwk { { String tests[] = { "\\u00e2T", "aT" }; String att[] = { "strength", "CaseLevel" }; - Object attVals[] = { new Integer(Collator.PRIMARY), Boolean.TRUE }; + Object attVals[] = { Collator.PRIMARY, Boolean.TRUE }; String tests2[] = { "a", "A" }; String rule = "&[first tertiary ignorable]=A=a"; String att2[] = { "CaseLevel" }; diff --git a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationRegressionTest.java b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationRegressionTest.java index 9650f4bfb9c..33b24a3e16c 100644 --- a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationRegressionTest.java +++ b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationRegressionTest.java @@ -1077,7 +1077,7 @@ public class CollationRegressionTest extends TestFmwk { // Iterate forward and collect all of the elements into a Vector while ((elem = iter.next()) != CollationElementIterator.NULLORDER) { - elements.add(new Integer(elem)); + elements.add(elem); } // Now iterate backward and make sure they're the same diff --git a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationServiceTest.java b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationServiceTest.java index d9981e5c468..8ed39d72d33 100644 --- a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationServiceTest.java +++ b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/collator/CollationServiceTest.java @@ -424,10 +424,10 @@ public class CollationServiceTest extends TestFmwk { boolean expectAvailable = DATA[(i*3)+2].equals("t"); ULocale actual = Collator.getFunctionalEquivalent(kw[0],input,isAvailable); if(!actual.equals(expect) || (expectAvailable!=isAvailable[0])) { - errln("#" + i + ": Collator.getFunctionalEquivalent(" + input + ")=" + actual + ", avail " + new Boolean(isAvailable[0]) + ", " + - "expected " + expect + " avail " + new Boolean(expectAvailable)); + errln("#" + i + ": Collator.getFunctionalEquivalent(" + input + ")=" + actual + ", avail " + isAvailable[0] + ", " + + "expected " + expect + " avail " + expectAvailable); } else { - logln("#" + i + ": Collator.getFunctionalEquivalent(" + input + ")=" + actual + ", avail " + new Boolean(isAvailable[0])); + logln("#" + i + ": Collator.getFunctionalEquivalent(" + input + ")=" + actual + ", avail " + isAvailable[0]); } } } diff --git a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleCollationTest.java b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleCollationTest.java index b836d44b092..1a3e61426a6 100644 --- a/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleCollationTest.java +++ b/icu4j/main/collate/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleCollationTest.java @@ -129,7 +129,7 @@ public final class ICUResourceBundleCollationTest extends TestFmwk { logln("Testing getting collation values:"); kwVals = ICUResourceBundle.getKeywordValues(ICUData.ICU_COLLATION_BASE_NAME,COLLATION_RESNAME); for(n=0;n " + expectLocale.toString() + ", but got " + new Boolean(gotAvail).toString() + " " + - equivLocale.toString()); + errln("" + i/3 + ": Error, expected Equiv=" + expectAvail + "\t\t" + + inLocale + "\t\t--> " + expectLocale + ", but got " + gotAvail + " " + + equivLocale); } } } diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/DateFormatTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/DateFormatTest.java index 6fa4036f549..4e9163fe45d 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/DateFormatTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/DateFormatTest.java @@ -2487,7 +2487,7 @@ public class DateFormatTest extends CoreTestFmwk { f.format((Object)cal, buf, pos); f.format((Object)now, buf, pos); - f.format(new Long(now.getTime()), buf, pos); + f.format(now.getTime(), buf, pos); try { f.format("Howdy", buf, pos); } @@ -3619,7 +3619,7 @@ public class DateFormatTest extends CoreTestFmwk { errln("FAIL: Date must be accepted by formatToCharacterIterator"); } - Number num = new Long(d.getTime()); + Number num = d.getTime(); try { acit = df.formatToCharacterIterator(num); if (acit == null) { diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java index e8d91494ea1..2cb92a4d09e 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/IntlTestDecimalFormatAPIC.java @@ -305,8 +305,8 @@ public class IntlTestDecimalFormatAPIC extends CoreTestFmwk { @Test public void testFormatToCharacterIterator() { - Number number = new Double(350.76); - Number negativeNumber = new Double(-350.76); + Number number = 350.76d; + Number negativeNumber = -350.76d; Locale us = Locale.US; @@ -339,12 +339,12 @@ public class IntlTestDecimalFormatAPIC extends CoreTestFmwk { getNegativeCurrencyVectorUS()); // test multiple grouping separators - number = new Long(100300400); + number = 100300400L; t_Format(11, number, NumberFormat.getNumberInstance(us), getNumberVector2US()); // test 0 - number = new Long(0); + number = 0L; t_Format(12, number, NumberFormat.getNumberInstance(us), getZeroVector()); } @@ -508,7 +508,7 @@ public class IntlTestDecimalFormatAPIC extends CoreTestFmwk { // called from support_messageformat tests public FieldContainer(int start, int end, AttributedCharacterIterator.Attribute attribute, int value) { - this(start, end, attribute, new Integer(value)); + this(start, end, attribute, Integer.valueOf(value)); } // called from support_messageformat tests diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/MeasureUnitTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/MeasureUnitTest.java index d9d5a825c80..1a29c1b536d 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/MeasureUnitTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/MeasureUnitTest.java @@ -3916,7 +3916,7 @@ public class MeasureUnitTest extends CoreTestFmwk { System.out.println(" * Returns by value, unit of " + type + ": " + code + "."); System.out.printf(" * Also see {@link #create%s()}.\n", name); String getterVersion = getVersion(javaName, thisVersion); - if (Integer.valueOf(getterVersion) < 64) { + if (Integer.parseInt(getterVersion) < 64) { getterVersion = "64"; } if (isDraft(javaName)) { diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/NumberFormatTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/NumberFormatTest.java index ad7cdf13e22..1278656dc65 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/NumberFormatTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/NumberFormatTest.java @@ -538,7 +538,7 @@ public class NumberFormatTest extends CoreTestFmwk { for (int i=0; i map = new HashMap(); - map.put("_oOo_", new Integer(3)); + map.put("_oOo_", 3); StringBuffer result = new StringBuffer(); assertEquals("trim-named-arg format() failed", "x 3 y", m.format(map, result, new FieldPosition(FieldPosition_DONT_CARE)).toString()); diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java index ae42fce19f4..fb0f8005136 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/format/TimeZoneFormatTest.java @@ -543,10 +543,10 @@ public class TimeZoneFormatTest extends CoreTestFmwk { // These special cases do not round trip time as designed. private boolean isSpecialTimeRoundTripCase(ULocale loc, String id, String pattern, long time) { final Object[][] EXCLUSIONS = { - {null, "Asia/Chita", "zzzz", Long.valueOf(1414252800000L)}, - {null, "Asia/Chita", "vvvv", Long.valueOf(1414252800000L)}, - {null, "Asia/Srednekolymsk", "zzzz", Long.valueOf(1414241999999L)}, - {null, "Asia/Srednekolymsk", "vvvv", Long.valueOf(1414241999999L)}, + {null, "Asia/Chita", "zzzz", 1414252800000L}, + {null, "Asia/Chita", "vvvv", 1414252800000L}, + {null, "Asia/Srednekolymsk", "zzzz", 1414241999999L}, + {null, "Asia/Srednekolymsk", "vvvv", 1414241999999L}, }; boolean isExcluded = false; for (Object[] excl : EXCLUSIONS) { diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/FormatHandler.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/FormatHandler.java index 47b0980f7a4..bb71dd1afd9 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/FormatHandler.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/FormatHandler.java @@ -1144,7 +1144,7 @@ public class FormatHandler // reproduced since formatToCharacterIterator was introduced, // up to ICU 4.0. - AttributedCharacterIterator aci = formats[0].formatToCharacterIterator(new Double(12.345D)); + AttributedCharacterIterator aci = formats[0].formatToCharacterIterator(12.345d); if (aci == null) {} // NOP - for resolving 'Unused local variable' warning. } return formats; @@ -1782,7 +1782,7 @@ public class FormatHandler { MessageFormat mfa = (MessageFormat) a; MessageFormat mfb = (MessageFormat) b; - Object arguments[] = {new Integer(123456)}; + Object arguments[] = {123456}; return mfa.format(arguments) != mfb.format(arguments); } diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/SerializableTestUtility.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/SerializableTestUtility.java index 8624cce7fdf..6b8daf0c5bd 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/SerializableTestUtility.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/serializable/SerializableTestUtility.java @@ -767,7 +767,7 @@ public class SerializableTestUtility { @Override public Object[] getTestObjects() { Mf2DataModel.OrderedMap mapWithContent = new Mf2DataModel.OrderedMap<>(); - mapWithContent.put("number", Double.valueOf(3.1416)); + mapWithContent.put("number", 3.1416d); mapWithContent.put("date", new Date(1664582400000L /* 20221001T000000Z */)); mapWithContent.put("string", "testing"); return new Mf2DataModel.OrderedMap[] { diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java index de760d4c6c8..849b9b106cf 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUResourceBundleTest.java @@ -801,16 +801,16 @@ public final class ICUResourceBundleTest extends CoreTestFmwk { ULocale inLocale = new ULocale(testCases[i+1]); ULocale expectLocale = new ULocale(testCases[i+2]); - logln(new Integer(i/3).toString() + ": " + new Boolean(expectAvail).toString() + "\t\t" + - inLocale.toString() + "\t\t" + expectLocale.toString()); + logln("" + i/3 + ": " + expectAvail + "\t\t" + + inLocale + "\t\t" + expectLocale); ULocale equivLocale = ICUResourceBundle.getFunctionalEquivalent(path, cl, resName, keyword, inLocale, isAvail, truncate); boolean gotAvail = isAvail[0]; if((gotAvail != expectAvail) || !equivLocale.equals(expectLocale)) { - errln(new Integer(i/3).toString() + ": Error, expected Equiv=" + new Boolean(expectAvail).toString() + "\t\t" + - inLocale.toString() + "\t\t--> " + expectLocale.toString() + ", but got " + new Boolean(gotAvail).toString() + " " + - equivLocale.toString()); + errln("" + i/3 + ": Error, expected Equiv=" + expectAvail + "\t\t" + + inLocale + "\t\t--> " + expectLocale + ", but got " + gotAvail + " " + + equivLocale); } } } diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUServiceTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUServiceTest.java index 4006ec8d144..e6232671216 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUServiceTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ICUServiceTest.java @@ -118,7 +118,7 @@ public class ICUServiceTest extends CoreTestFmwk // register an object with one locale, // search for an object with a more specific locale // should return the original object - Integer singleton0 = new Integer(0); + Integer singleton0 = 0; service.registerObject(singleton0, "en_US"); Object result = service.get("en_US_FOO"); confirmIdentical("1) en_US_FOO -> en_US", result, singleton0); @@ -126,7 +126,7 @@ public class ICUServiceTest extends CoreTestFmwk // register a new object with the more specific locale // search for an object with that locale // should return the new object - Integer singleton1 = new Integer(1); + Integer singleton1 = 1; service.registerObject(singleton1, "en_US_FOO"); result = service.get("en_US_FOO"); confirmIdentical("2) en_US_FOO -> en_US_FOO", result, singleton1); @@ -141,7 +141,7 @@ public class ICUServiceTest extends CoreTestFmwk // register a new object with yet another locale // original factory list is unchanged - Integer singleton2 = new Integer(2); + Integer singleton2 = 2; service.registerObject(singleton2, "en"); confirmIdentical("5) factory size", factories.size(), 2); @@ -152,7 +152,7 @@ public class ICUServiceTest extends CoreTestFmwk confirmIdentical("6) en_US_BAR -> en_US", result, singleton0); // register a new object with an old id, should hide earlier factory using this id, but leave it there - Integer singleton3 = new Integer(3); + Integer singleton3 = 3; service.registerObject(singleton3, "en_US"); factories = service.factories(); confirmIdentical("9) factory size", factories.size(), 4); @@ -188,7 +188,7 @@ public class ICUServiceTest extends CoreTestFmwk // should be able to register invisible factories, these will not // be visible by default, but if you know the secret password you // can still access these services... - Integer singleton4 = new Integer(4); + Integer singleton4 = 4; service.registerObject(singleton4, "en_US_BAR", false); result = service.get("en_US_BAR"); confirmIdentical("17) get invisible", result, singleton4); diff --git a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ULocaleTest.java b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ULocaleTest.java index 4c6e36cc00a..7a0067aa6f3 100644 --- a/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ULocaleTest.java +++ b/icu4j/main/common_tests/src/test/java/com/ibm/icu/dev/test/util/ULocaleTest.java @@ -1734,7 +1734,7 @@ public class ULocaleTest extends CoreTestFmwk { } else { errln("#" + i + ": locale: expected " + expectLocale + " but got " + n); } - Boolean actualBoolean = Boolean.valueOf(r[0]); + Boolean actualBoolean = r[0]; if(expectBoolean.equals(actualBoolean)) { logln("#" + i + ": fallback: OK."); } else { @@ -1765,7 +1765,7 @@ public class ULocaleTest extends CoreTestFmwk { } else { errln("#" + i + ": expected " + expectLocale + " but got " + n.toString()); } - Boolean actualBoolean = Boolean.valueOf(r[0]); + Boolean actualBoolean = r[0]; if(expectBoolean.equals(actualBoolean)) { logln("#" + i + ": fallback: OK."); } else { @@ -4338,7 +4338,7 @@ public class ULocaleTest extends CoreTestFmwk { @Test public void TestForLanguageTag() { - final Integer NOERROR = Integer.valueOf(-1); + final Integer NOERROR = -1; final Object[][] langtag_to_locale = { {"en", "en", NOERROR}, @@ -4346,24 +4346,24 @@ public class ULocaleTest extends CoreTestFmwk { {"und-us", "_US", NOERROR}, {"und-latn", "_Latn", NOERROR}, {"en-us-posix", "en_US_POSIX", NOERROR}, - {"de-de_euro", "de", Integer.valueOf(3)}, + {"de-de_euro", "de", 3}, {"kok-in", "kok_IN", NOERROR}, - {"123", "", Integer.valueOf(0)}, - {"en_us", "", Integer.valueOf(0)}, - {"en-latn-x", "en_Latn", Integer.valueOf(8)}, + {"123", "", 0}, + {"en_us", "", 0}, + {"en-latn-x", "en_Latn", 8}, {"art-lojban", "jbo", NOERROR}, {"zh-hakka", "hak", NOERROR}, {"zh-cmn-CH", "cmn_CH", NOERROR}, {"xxx-yy", "xxx_YY", NOERROR}, {"fr-234", "fr_234", NOERROR}, {"i-default", "en@x=i-default", NOERROR}, - {"i-test", "", Integer.valueOf(0)}, - {"ja-jp-jp", "ja_JP", Integer.valueOf(6)}, + {"i-test", "", 0}, + {"ja-jp-jp", "ja_JP", 6}, {"bogus", "bogus", NOERROR}, - {"boguslang", "", Integer.valueOf(0)}, + {"boguslang", "", 0}, {"EN-lATN-us", "en_Latn_US", NOERROR}, {"und-variant-1234", "__1234_VARIANT", NOERROR}, /* ICU-20478 */ - {"und-varzero-var1-vartwo", "__VARZERO", Integer.valueOf(12)}, + {"und-varzero-var1-vartwo", "__VARZERO", 12}, {"en-u-ca-gregory", "en@calendar=gregorian", NOERROR}, {"en-U-cu-USD", "en@currency=usd", NOERROR}, {"en-us-u-va-posix", "en_US_POSIX", NOERROR}, @@ -4378,8 +4378,8 @@ public class ULocaleTest extends CoreTestFmwk { {"en-us-u-tz-usnyc", "en_US@timezone=America/New_York", NOERROR}, {"und-a-abc-def", "@a=abc-def", NOERROR}, {"zh-u-ca-chinese-x-u-ca-chinese", "zh@calendar=chinese;x=u-ca-chinese", NOERROR}, - {"fr--FR", "fr", Integer.valueOf(3)}, - {"fr-", "fr", Integer.valueOf(3)}, + {"fr--FR", "fr", 3}, + {"fr-", "fr", 3}, {"x-elmer", "@x=elmer", NOERROR}, {"en-US-u-attr1-attr2-ca-gregory", "en_US@attribute=attr1-attr2;calendar=gregorian", NOERROR}, {"sr-u-kn", "sr@colnumeric=yes", NOERROR}, @@ -4387,7 +4387,7 @@ public class ULocaleTest extends CoreTestFmwk { {"en-u-attr2-attr1-kn-kb", "en@attribute=attr1-attr2;colbackwards=yes;colnumeric=yes", NOERROR}, {"ja-u-ijkl-efgh-abcd-ca-japanese-xx-yyy-zzz-kn", "ja@attribute=abcd-efgh-ijkl;calendar=japanese;colnumeric=yes;xx=yyy-zzz", NOERROR}, {"de-u-xc-xphonebk-co-phonebk-ca-buddhist-mo-very-lo-extensi-xd-that-de-should-vc-probably-xz-killthebuffer", - "de@calendar=buddhist;collation=phonebook;de=should;lo=extensi;mo=very;vc=probably;xc=xphonebk;xd=that;xz=yes", Integer.valueOf(92)}, + "de@calendar=buddhist;collation=phonebook;de=should;lo=extensi;mo=very;vc=probably;xc=xphonebk;xd=that;xz=yes", 92}, /* #12761 */ {"en-a-bar-u-baz", "en@a=bar;attribute=baz", NOERROR}, {"en-a-bar-u-baz-x-u-foo", "en@a=bar;attribute=baz;x=u-foo", NOERROR}, @@ -4396,10 +4396,10 @@ public class ULocaleTest extends CoreTestFmwk { {"en-a-bar-u-ca-islamic-civil-x-u-foo", "en@a=bar;calendar=islamic-civil;x=u-foo", NOERROR}, {"en-a-bar-u-baz-ca-islamic-civil-x-u-foo", "en@a=bar;attribute=baz;calendar=islamic-civil;x=u-foo", NOERROR}, /* #20098 */ - {"hant-cmn-cn", "hant", Integer.valueOf(5)}, + {"hant-cmn-cn", "hant", 5}, {"zh-cmn-TW", "cmn_TW", NOERROR}, - {"zh-x_t-ab", "zh", Integer.valueOf(3)}, - {"zh-hans-cn-u-ca-x_t-u", "zh_Hans_CN@calendar=yes", Integer.valueOf(16)}, + {"zh-x_t-ab", "zh", 3}, + {"zh-hans-cn-u-ca-x_t-u", "zh_Hans_CN@calendar=yes", 16}, /* #20140 dupe keys in U-extension */ {"zh-u-ca-chinese-ca-gregory", "zh@calendar=chinese", NOERROR}, {"zh-u-ca-gregory-co-pinyin-ca-chinese", "zh@calendar=gregorian;collation=pinyin", NOERROR}, @@ -4542,7 +4542,7 @@ public class ULocaleTest extends CoreTestFmwk { for (int i = 0; i < nExtensions; i++) { String kstr = testcase[i/2 + 1]; - String ext = loc.getExtension(Character.valueOf(kstr.charAt(0))); + String ext = loc.getExtension(kstr.charAt(0)); if (ext == null || !ext.equals(testcase[i/2 + 2])) { errln("Incorrect extension value: key=" + kstr + ", returned=" + ext + ", expected=" + testcase[i/2 + 2] diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/DateNumberFormat.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/DateNumberFormat.java index b20080a1734..0e913f3dfbc 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/DateNumberFormat.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/DateNumberFormat.java @@ -243,7 +243,7 @@ public final class DateNumberFormat extends NumberFormat { Number result = null; if (sawNumber) { num = negative ? num * (-1) : num; - result = Long.valueOf(num); + result = num; parsePosition.setIndex(base + offset); } return result; diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/ICUResourceBundle.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/ICUResourceBundle.java index 58c8c6c006d..3263b844664 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/ICUResourceBundle.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/ICUResourceBundle.java @@ -270,7 +270,7 @@ public class ICUResourceBundle extends UResourceBundle { } } } catch (Throwable t) { - //System.err.println("Error in - " + new Integer(i).toString() + //System.err.println("Error in - " + i // + " - " + t.toString()); // ignore the err - just skip that resource } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/PropsVectors.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/PropsVectors.java index 5d19ece3eed..3565e42aa6e 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/PropsVectors.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/PropsVectors.java @@ -378,7 +378,7 @@ public class PropsVectors { // sort the properties vectors to find unique vector values Integer[] indexArray = new Integer[rows]; for (int i = 0; i < rows; ++i) { - indexArray[i] = Integer.valueOf(columns * i); + indexArray[i] = columns * i; } Arrays.sort(indexArray, new Comparator() { diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/ZoneMeta.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/ZoneMeta.java index 4081faf8936..3b72fdb48fa 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/ZoneMeta.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/ZoneMeta.java @@ -503,7 +503,7 @@ public final class ZoneMeta { if (singleZone == null) { Set ids = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL_LOCATION, country, null); assert(ids.size() >= 1); - singleZone = Boolean.valueOf(ids.size() <= 1); + singleZone = ids.size() <= 1; SINGLE_COUNTRY_CACHE.put(tzid, singleZone); } @@ -648,8 +648,7 @@ public final class ZoneMeta { // fields[1] - hour / 5-bit // fields[2] - min / 6-bit // fields[3] - sec / 6-bit - Integer key = Integer.valueOf( - fields[0] * (fields[1] | fields[2] << 5 | fields[3] << 11)); + Integer key = fields[0] * (fields[1] | fields[2] << 5 | fields[3] << 11); return CUSTOM_ZONE_CACHE.getInstance(key, fields); } return null; diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/BurmeseBreakEngine.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/BurmeseBreakEngine.java index 12352e4dc47..526413bc130 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/BurmeseBreakEngine.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/BurmeseBreakEngine.java @@ -198,7 +198,7 @@ public class BurmeseBreakEngine extends DictionaryBreakEngine { // Did we find a word on this iteration? If so, push it on the break stack if (wordLength > 0) { - foundBreaks.push(Integer.valueOf(current + wordLength)); + foundBreaks.push(current + wordLength); } } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/KhmerBreakEngine.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/KhmerBreakEngine.java index bd3fa9f2ded..20ade41eff7 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/KhmerBreakEngine.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/KhmerBreakEngine.java @@ -206,7 +206,7 @@ public class KhmerBreakEngine extends DictionaryBreakEngine { // Did we find a word on this iteration? If so, push it on the break stack if (wordLength > 0) { - foundBreaks.push(Integer.valueOf(current + wordLength)); + foundBreaks.push(current + wordLength); } } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/LaoBreakEngine.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/LaoBreakEngine.java index e60271aa5a4..c2cb3626960 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/LaoBreakEngine.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/LaoBreakEngine.java @@ -206,7 +206,7 @@ public class LaoBreakEngine extends DictionaryBreakEngine { // Did we find a word on this iteration? If so, push it on the break stack if (wordLength > 0) { - foundBreaks.push(Integer.valueOf(current + wordLength)); + foundBreaks.push(current + wordLength); } } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/ThaiBreakEngine.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/ThaiBreakEngine.java index 3f96705109b..36099382cfd 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/ThaiBreakEngine.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/breakiter/ThaiBreakEngine.java @@ -250,7 +250,7 @@ public class ThaiBreakEngine extends DictionaryBreakEngine { // Did we find a word on this iteration? If so, push it on the break stack if (wordLength > 0) { - foundBreaks.push(Integer.valueOf(current + wordLength)); + foundBreaks.push(current + wordLength); } } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/locale/LocaleExtensions.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/locale/LocaleExtensions.java index ffc498adf64..af40c2f27bd 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/locale/LocaleExtensions.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/locale/LocaleExtensions.java @@ -40,12 +40,12 @@ public class LocaleExtensions { CALENDAR_JAPANESE = new LocaleExtensions(); CALENDAR_JAPANESE._id = "u-ca-japanese"; CALENDAR_JAPANESE._map = new TreeMap(); - CALENDAR_JAPANESE._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.CA_JAPANESE); + CALENDAR_JAPANESE._map.put(UnicodeLocaleExtension.SINGLETON, UnicodeLocaleExtension.CA_JAPANESE); NUMBER_THAI = new LocaleExtensions(); NUMBER_THAI._id = "u-nu-thai"; NUMBER_THAI._map = new TreeMap(); - NUMBER_THAI._map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), UnicodeLocaleExtension.NU_THAI); + NUMBER_THAI._map.put(UnicodeLocaleExtension.SINGLETON, UnicodeLocaleExtension.NU_THAI); } private LocaleExtensions() { @@ -67,7 +67,7 @@ public class LocaleExtensions { } // Build extension map - _map = new TreeMap(); + _map = new TreeMap<>(); if (hasExtension) { for (Entry ext : extensions.entrySet()) { char key = AsciiUtil.toLower(ext.getKey().value()); @@ -82,7 +82,7 @@ public class LocaleExtensions { } Extension e = new Extension(key, AsciiUtil.toLowerString(value)); - _map.put(Character.valueOf(key), e); + _map.put(key, e); } } @@ -107,7 +107,7 @@ public class LocaleExtensions { } UnicodeLocaleExtension ule = new UnicodeLocaleExtension(uaset, ukmap); - _map.put(Character.valueOf(UnicodeLocaleExtension.SINGLETON), ule); + _map.put(UnicodeLocaleExtension.SINGLETON, ule); } if (_map.size() == 0) { @@ -124,11 +124,11 @@ public class LocaleExtensions { } public Extension getExtension(Character key) { - return _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue()))); + return _map.get(AsciiUtil.toLower(key.charValue())); } public String getExtensionValue(Character key) { - Extension ext = _map.get(Character.valueOf(AsciiUtil.toLower(key.charValue()))); + Extension ext = _map.get(AsciiUtil.toLower(key.charValue())); if (ext == null) { return null; } @@ -136,7 +136,7 @@ public class LocaleExtensions { } public Set getUnicodeLocaleAttributes() { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = _map.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return Collections.emptySet(); } @@ -145,7 +145,7 @@ public class LocaleExtensions { } public Set getUnicodeLocaleKeys() { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = _map.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return Collections.emptySet(); } @@ -154,7 +154,7 @@ public class LocaleExtensions { } public String getUnicodeLocaleType(String unicodeLocaleKey) { - Extension ext = _map.get(Character.valueOf(UnicodeLocaleExtension.SINGLETON)); + Extension ext = _map.get(UnicodeLocaleExtension.SINGLETON); if (ext == null) { return null; } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/DecimalQuantity_AbstractBCD.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/DecimalQuantity_AbstractBCD.java index a02a48e8213..415d8a82c48 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/DecimalQuantity_AbstractBCD.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/DecimalQuantity_AbstractBCD.java @@ -718,7 +718,7 @@ public abstract class DecimalQuantity_AbstractBCD implements DecimalQuantity { StringBuilder sb = new StringBuilder(); toScientificString(sb); - return Double.valueOf(sb.toString()); + return Double.parseDouble(sb.toString()); } @Override diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/Grouper.java b/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/Grouper.java index a15ac6f2384..3b98cf61f11 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/Grouper.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/impl/number/Grouper.java @@ -80,7 +80,7 @@ public class Grouper { ICUResourceBundle resource = (ICUResourceBundle) UResourceBundle .getBundleInstance(ICUData.ICU_BASE_NAME, locale); String result = resource.getStringWithFallback("NumberElements/minimumGroupingDigits"); - return Short.valueOf(result); + return Short.parseShort(result); } /** diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/math/BigDecimal.java b/icu4j/main/core/src/main/java/com/ibm/icu/math/BigDecimal.java index be4ca3b2bc7..45266c4b6b4 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/math/BigDecimal.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/math/BigDecimal.java @@ -2887,7 +2887,7 @@ public class BigDecimal extends java.lang.Number implements java.io.Serializable // Reminder: a zero double returns '0.0', so we cannot fastpath to // use the constant ZERO. This might be important enough to justify // a factory approach, a cache, or a few private constants, later. - return new com.ibm.icu.math.BigDecimal((new java.lang.Double(dub)).toString()); + return new com.ibm.icu.math.BigDecimal(Double.toString(dub)); } /** diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/number/UnlocalizedNumberFormatter.java b/icu4j/main/core/src/main/java/com/ibm/icu/number/UnlocalizedNumberFormatter.java index 57c01bee4ec..8d6e1fc05b8 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/number/UnlocalizedNumberFormatter.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/number/UnlocalizedNumberFormatter.java @@ -19,7 +19,7 @@ public class UnlocalizedNumberFormatter extends NumberFormatterSettings parent, int key, Object value) { diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/text/MessageFormat.java b/icu4j/main/core/src/main/java/com/ibm/icu/text/MessageFormat.java index a4694285dbc..033587fb395 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/text/MessageFormat.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/text/MessageFormat.java @@ -1305,7 +1305,7 @@ public class MessageFormat extends UFormat { String key = null; if(args!=null) { argNumber=part.getValue(); // ARG_NUMBER - argId = Integer.valueOf(argNumber); + argId = argNumber; } else { if(part.getType()==MessagePattern.Part.Type.ARG_NAME) { key=msgPattern.getSubstring(part); @@ -1673,7 +1673,7 @@ public class MessageFormat extends UFormat { int argNumber=part.getValue(); // ARG_NUMBER if (dest.attributes != null) { // We only need argId if we add it into the attributes. - argId = Integer.valueOf(argNumber); + argId = argNumber; } if(0<=argNumber && argNumber s0 = new TreeSet<>(); // mapping for rules with no explicit tagging - fRB.fStatusSets.put(s0, Integer.valueOf(0)); // (key is an empty set). + fRB.fStatusSets.put(s0, 0); // (key is an empty set). SortedSet s1 = new TreeSet<>(); // mapping for rules with explicit tagging of {0} - s1.add(Integer.valueOf(0)); - fRB.fStatusSets.put(s1, Integer.valueOf(0)); + s1.add(0); + fRB.fStatusSets.put(s1, 0); } // For each state, check whether the state's status tag values are @@ -821,12 +821,12 @@ class RBBITableBuilder { // Add them to the statusSets map, This map associates // the set of status values with an index in the runtime status // values array. - arrayIndexI = Integer.valueOf(fRB.fRuleStatusVals.size()); + arrayIndexI = fRB.fRuleStatusVals.size(); fRB.fStatusSets.put(statusVals, arrayIndexI); // Add the new set of status values to the vector of values that // will eventually become the array used by the runtime engine. - fRB.fRuleStatusVals.add(Integer.valueOf(statusVals.size())); + fRB.fRuleStatusVals.add(statusVals.size()); fRB.fRuleStatusVals.addAll(statusVals); } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/text/SimpleDateFormat.java b/icu4j/main/core/src/main/java/com/ibm/icu/text/SimpleDateFormat.java index a5f2bc06962..d2dadeb7418 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/text/SimpleDateFormat.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/text/SimpleDateFormat.java @@ -3941,7 +3941,7 @@ public class SimpleDateFormat extends DateFormat { nDigits--; } pos.setIndex(oldPos + maxDigits); - number = Integer.valueOf((int)val); + number = (int) val; } } return number; @@ -4640,8 +4640,7 @@ public class SimpleDateFormat extends DateFormat { * @stable ICU 54 */ public NumberFormat getNumberFormat(char field) { - Character ovrField; - ovrField = Character.valueOf(field); + Character ovrField = field; if (overrideMap != null && overrideMap.containsKey(ovrField)) { String nsName = overrideMap.get(ovrField).toString(); NumberFormat nf = numberFormatters.get(nsName); @@ -4687,7 +4686,7 @@ public class SimpleDateFormat extends DateFormat { fullOverride = true; } else { // Field specific override string such as "y=hebrew" nsName = currentString.substring(equalSignPosition+1); - ovrField = Character.valueOf(currentString.charAt(0)); + ovrField = currentString.charAt(0); overrideMap.put(ovrField,nsName); fullOverride = false; } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/text/TimeUnitFormat.java b/icu4j/main/core/src/main/java/com/ibm/icu/text/TimeUnitFormat.java index 32c74233b61..ea3421d8d2c 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/text/TimeUnitFormat.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/text/TimeUnitFormat.java @@ -307,15 +307,15 @@ public class TimeUnitFormat extends MeasureFormat { if (resultNumber == null && longestParseDistance != 0) { // set the number using plurrual count if (countOfLongestMatch.equals("zero")) { - resultNumber = Integer.valueOf(0); + resultNumber = 0; } else if (countOfLongestMatch.equals("one")) { - resultNumber = Integer.valueOf(1); + resultNumber = 1; } else if (countOfLongestMatch.equals("two")) { - resultNumber = Integer.valueOf(2); + resultNumber = 2; } else { // should not happen. // TODO: how to handle? - resultNumber = Integer.valueOf(3); + resultNumber = 3; } } if (longestParseDistance == 0) { diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/util/Calendar.java b/icu4j/main/core/src/main/java/com/ibm/icu/util/Calendar.java index 69bcf1bb2e0..fd53ab5c081 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/util/Calendar.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/util/Calendar.java @@ -5862,12 +5862,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable ids = getAvailableIDs(SystemTimeZoneType.ANY, null, Integer.valueOf(rawOffset)); + Set ids = getAvailableIDs(SystemTimeZoneType.ANY, null, rawOffset); return ids.toArray(new String[0]); } diff --git a/icu4j/main/core/src/main/java/com/ibm/icu/util/VersionInfo.java b/icu4j/main/core/src/main/java/com/ibm/icu/util/VersionInfo.java index 4f272f467dd..8e5c7c9fdfd 100644 --- a/icu4j/main/core/src/main/java/com/ibm/icu/util/VersionInfo.java +++ b/icu4j/main/core/src/main/java/com/ibm/icu/util/VersionInfo.java @@ -336,7 +336,7 @@ public final class VersionInfo implements Comparable throw new IllegalArgumentException(INVALID_VERSION_NUMBER_); } int version = getInt(major, minor, milli, micro); - Integer key = Integer.valueOf(version); + Integer key = version; VersionInfo result = MAP_.get(key); if (result == null) { result = new VersionInfo(version); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/data/TestDataElements_testtypes.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/data/TestDataElements_testtypes.java index 51edd38c3bf..b1bf7f1013c 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/data/TestDataElements_testtypes.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/data/TestDataElements_testtypes.java @@ -39,7 +39,7 @@ public class TestDataElements_testtypes extends ListResourceBundle { }, { "emptyint", - new Integer(0), + 0, }, { "emptyintv", @@ -64,14 +64,14 @@ public class TestDataElements_testtypes extends ListResourceBundle { { "integerarray", new Integer[] { - new Integer(1), - new Integer(2), - new Integer(3), - new Integer(-3), - new Integer(4), - new Integer(5), - new Integer(6), - new Integer(7), + 1, + 2, + 3, + -3, + 4, + 5, + 6, + 7, }, }, { @@ -98,19 +98,19 @@ public class TestDataElements_testtypes extends ListResourceBundle { }, { "minusone", - new Integer(-1), + -1, }, { "one", - new Integer(1), + 1, }, { "onehundredtwentythree", - new Integer(123), + 123, }, { "plusone", - new Integer(1), + 1, }, { "string", diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestClassOverride.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestClassOverride.java index a044abcb9b1..cfdb8bda607 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestClassOverride.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestClassOverride.java @@ -122,7 +122,7 @@ public class TestClassOverride extends BidiFmwk { bidi = new Bidi(); verifyClassifier(bidi); - classifier = new CustomClassifier(new Integer(TestData.R)); + classifier = new CustomClassifier(TestData.R); bidi.setCustomClassifier(classifier); verifyClassifier(bidi); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestCompatibility.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestCompatibility.java index d7c1cc470bc..05ce2d43007 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestCompatibility.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bidi/TestCompatibility.java @@ -203,9 +203,9 @@ public class TestCompatibility extends BidiFmwk { AttributedString as = new AttributedString("HEBREW 123 english MOREHEB"); as.addAttribute(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL); as.addAttribute(TextAttribute.NUMERIC_SHAPING, NumericShaper.getShaper(NumericShaper.ARABIC)); - as.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(1), 0, 26); - as.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-1), 0, 6); - as.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(-1), 19, 26); + as.addAttribute(TextAttribute.BIDI_EMBEDDING, 1, 0, 26); + as.addAttribute(TextAttribute.BIDI_EMBEDDING, -1, 0, 6); + as.addAttribute(TextAttribute.BIDI_EMBEDDING, -1, 19, 26); bidi = new Bidi(as.getIterator()); jbidi = new java.text.Bidi(as.getIterator()); compareBidi(bidi, jbidi); @@ -214,7 +214,7 @@ public class TestCompatibility extends BidiFmwk { as = new AttributedString("HEBREW 123 english MOREHEB"); as.addAttribute(TextAttribute.RUN_DIRECTION, TextAttribute.RUN_DIRECTION_RTL); - as.addAttribute(TextAttribute.BIDI_EMBEDDING, new Integer(0), 0, 26); + as.addAttribute(TextAttribute.BIDI_EMBEDDING, 0, 0, 26); bidi = new Bidi(as.getIterator()); jbidi = new java.text.Bidi(as.getIterator()); compareBidi(bidi, jbidi); @@ -256,7 +256,7 @@ public class TestCompatibility extends BidiFmwk { Character[] objects = new Character[10]; levels = new byte[objects.length]; for (int i = 0; i < objects.length; i++) { - objects[i] = new Character((char)('a'+i)); + objects[i] = (char)('a'+i); levels[i] = myLevels[i]; } Bidi.reorderVisually(levels, 3, objects, 3, 7); @@ -265,7 +265,7 @@ public class TestCompatibility extends BidiFmwk { strbidi += objects[i].toString(); } for (int i = 0; i < objects.length; i++) { - objects[i] = new Character((char)('a'+i)); + objects[i] = (char)('a'+i); levels[i] = myLevels[i]; } java.text.Bidi.reorderVisually(levels, 3, objects, 3, 7); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bigdec/DiagBigDecimalTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bigdec/DiagBigDecimalTest.java index 5e6360a4256..2395167c627 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bigdec/DiagBigDecimalTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/bigdec/DiagBigDecimalTest.java @@ -2918,15 +2918,15 @@ public class DiagBigDecimalTest extends CoreTestFmwk { java.lang.String val; // 1999.03.07 Infinities no longer errors val = "-1"; - TestFmwk.assertTrue("dov001", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((new java.lang.Double(val)).doubleValue())); + TestFmwk.assertTrue("dov001", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((Double.valueOf(val)).doubleValue())); val = "-0.1"; - TestFmwk.assertTrue("dov002", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((new java.lang.Double(val)).doubleValue())); + TestFmwk.assertTrue("dov002", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((Double.valueOf(val)).doubleValue())); val = "0"; - TestFmwk.assertTrue("dov003", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((new java.lang.Double(val)).doubleValue())); + TestFmwk.assertTrue("dov003", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((Double.valueOf(val)).doubleValue())); val = "0.1"; - TestFmwk.assertTrue("dov004", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((new java.lang.Double(val)).doubleValue())); + TestFmwk.assertTrue("dov004", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((Double.valueOf(val)).doubleValue())); val = "1"; - TestFmwk.assertTrue("dov005", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((new java.lang.Double(val)).doubleValue())); + TestFmwk.assertTrue("dov005", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == ((Double.valueOf(val)).doubleValue())); val = "1e1000"; TestFmwk.assertTrue("dov006", ((new com.ibm.icu.math.BigDecimal(val)).doubleValue()) == java.lang.Double.POSITIVE_INFINITY); val = "-1e1000"; @@ -2957,23 +2957,23 @@ public class DiagBigDecimalTest extends CoreTestFmwk { java.lang.String val; // 1999.03.07 Infinities no longer errors val = "-1"; - TestFmwk.assertTrue("flv001", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == ((new java.lang.Float(val)).floatValue())); + TestFmwk.assertTrue("flv001", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == (Float.valueOf(val).floatValue())); val = "-0.1"; - TestFmwk.assertTrue("flv002", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == ((new java.lang.Float(val)).floatValue())); + TestFmwk.assertTrue("flv002", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == (Float.valueOf(val).floatValue())); val = "0"; - TestFmwk.assertTrue("flv003", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == ((new java.lang.Float(val)).floatValue())); + TestFmwk.assertTrue("flv003", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == (Float.valueOf(val).floatValue())); val = "0.1"; - TestFmwk.assertTrue("flv004", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == ((new java.lang.Float(val)).floatValue())); + TestFmwk.assertTrue("flv004", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == (Float.valueOf(val).floatValue())); val = "1"; - TestFmwk.assertTrue("flv005", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == ((new java.lang.Float(val)).floatValue())); + TestFmwk.assertTrue("flv005", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == (Float.valueOf(val).floatValue())); val = "1e200"; - TestFmwk.assertTrue("flv006", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == java.lang.Float.POSITIVE_INFINITY); + TestFmwk.assertTrue("flv006", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == Float.POSITIVE_INFINITY); val = "-1e200"; - TestFmwk.assertTrue("flv007", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == java.lang.Float.NEGATIVE_INFINITY); + TestFmwk.assertTrue("flv007", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == Float.NEGATIVE_INFINITY); val = "1e1000"; - TestFmwk.assertTrue("flv008", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == java.lang.Float.POSITIVE_INFINITY); + TestFmwk.assertTrue("flv008", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == Float.POSITIVE_INFINITY); val = "-1e1000"; - TestFmwk.assertTrue("flv009", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == java.lang.Float.NEGATIVE_INFINITY); + TestFmwk.assertTrue("flv009", ((new com.ibm.icu.math.BigDecimal(val)).floatValue()) == Float.NEGATIVE_INFINITY); } /* ----------------------------------------------------------------- */ diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java index 6f8e7e5f340..9c0cec77be1 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/calendar/CalendarRegressionTest.java @@ -688,14 +688,10 @@ public class CalendarRegressionTest extends CoreTestFmwk { // Test field disambiguation with a few special hard-coded cases. // This shouldn't fail if the above cases aren't failing. Object[] DISAM = { - new Integer(1998), new Integer(1), new Integer(Calendar.SUNDAY), - d[0], - new Integer(1998), new Integer(2), new Integer(Calendar.SATURDAY), - d[1], - new Integer(1998), new Integer(53), new Integer(Calendar.THURSDAY), - d[2], - new Integer(1998), new Integer(53), new Integer(Calendar.FRIDAY), - d[3], + 1998, 1, Calendar.SUNDAY, d[0], + 1998, 2, Calendar.SATURDAY, d[1], + 1998, 53, Calendar.THURSDAY, d[2], + 1998, 53, Calendar.FRIDAY, d[3], }; testCal.setMinimalDaysInFirstWeek(3); testCal.setFirstDayOfWeek(Calendar.SUNDAY); @@ -739,10 +735,10 @@ public class CalendarRegressionTest extends CoreTestFmwk { d[7] = tempcal.getTime(); Object[] ADDROLL = { - ADD, new Integer(1), d[0], d[1], - ADD, new Integer(1), d[2], d[3], - ROLL, new Integer(1), d[4], d[5], - ROLL, new Integer(1), d[6], d[7], + ADD, 1, d[0], d[1], + ADD, 1, d[2], d[3], + ROLL, 1, d[4], d[5], + ROLL, 1, d[6], d[7], }; testCal.setMinimalDaysInFirstWeek(3); testCal.setFirstDayOfWeek(Calendar.SUNDAY); @@ -1693,9 +1689,9 @@ public class CalendarRegressionTest extends CoreTestFmwk { d[5] = tempcal.getTime(); // Test specific failure reported in bug Object[] DATA = { - new Integer(1), d[0], new Integer(4), d[1], - new Integer(8), d[2], new Integer(-1), d[3], - new Integer(-4), d[4], new Integer(-8), d[5], + 1, d[0], 4, d[1], + 8, d[2], -1, d[3], + -4, d[4], -8, d[5], }; for (int i=0; i minHigh) { errln("Fail: " + ymdToString(cal) + @@ -320,8 +320,8 @@ public class CalendarTestFmwk extends CoreTestFmwk { cal.getGreatestMinimum(f) : cal.getMaximum(f); // If either the top of the range or the bottom was never // seen, then there may be a problem. - if (h[k].get(new Integer(rangeLow)) == null || - h[k].get(new Integer(rangeHigh)) == null) { + if (h[k].get(rangeLow) == null || + h[k].get(rangeHigh) == null) { fullRangeSeen = false; } buf.append(k==0 ? " minima seen=(" : "; maxima seen=("); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/duration/ICUDurationTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/duration/ICUDurationTest.java index 8f94f6702a4..4a72c6197e9 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/duration/ICUDurationTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/duration/ICUDurationTest.java @@ -205,7 +205,7 @@ public class ICUDurationTest extends CoreTestFmwk { logln("format date from -> " + formatted); } - formatted = df.format(new Long(1000*3600*24*2)); + formatted = df.format(1000L*3600*24*2); expect = "fra due giorni"; if(!expect.equals(formatted)) { errln("Expected " + expect + " but got " + formatted); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/BigNumberFormatTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/BigNumberFormatTest.java index bb5d3558988..e1d370738f4 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/BigNumberFormatTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/BigNumberFormatTest.java @@ -35,7 +35,7 @@ public class BigNumberFormatTest extends CoreTestFmwk { DecimalFormatSymbols US = new DecimalFormatSymbols(Locale.US); DecimalFormat fmt1 = new DecimalFormat("0.###E0", US); DecimalFormat fmt2 = new DecimalFormat("0.###E+0", US); - Number n = new Long(1234); + Number n = 1234L; expect(fmt1, n, "1.234E3"); expect(fmt2, n, "1.234E+3"); expect(fmt1, "1.234E3", n); @@ -50,11 +50,11 @@ public class BigNumberFormatTest extends CoreTestFmwk { public void TestSecondaryGrouping() { DecimalFormatSymbols US = new DecimalFormatSymbols(Locale.US); DecimalFormat f = new DecimalFormat("#,##,###", US); - expect(f, new Long(123456789), "12,34,56,789"); + expect(f, 123456789L, "12,34,56,789"); expectPat(f, "#,##,##0"); f.applyPattern("#,###"); f.setSecondaryGroupingSize(4); - expect(f, new Long(123456789), "12,3456,789"); + expect(f, 123456789L, "12,3456,789"); expectPat(f, "#,####,##0"); // On Sun JDK 1.2-1.3, the hi_IN locale uses '0' for a zero digit, @@ -62,7 +62,7 @@ public class BigNumberFormatTest extends CoreTestFmwk { f = (DecimalFormat) NumberFormat.getInstance(new Locale("hi", "IN")); String str = transmute("1,87,65,43,210", f.getDecimalFormatSymbols().getZeroDigit()); - expect(f, new Long(1876543210), str); + expect(f, 1876543210L, str); } private void expectPad(DecimalFormat fmt, String pat, int pos) { @@ -189,19 +189,19 @@ public class BigNumberFormatTest extends CoreTestFmwk { DecimalFormatSymbols US = new DecimalFormatSymbols(Locale.US); /*For ICU compatibility [Richard/GCL]*/ expect(NumberFormat.getScientificInstance(Locale.US), - new Number[] { new Double(12345.678901), + new Number[] { 12345.678901d, new java.math.BigDecimal("12345.678901"), }, "1.2345678901E4"); expect(new DecimalFormat("##0.###E0", US), - new Double(12345), + 12345d, "12.34E3"); expect(new DecimalFormat("##0.###E0", US), - new Double(12345.00001), + 12345.00001d, "12.35E3"); expect(new DecimalFormat("##0.####E0", US), - new Number[] { new Integer(12345), - new Long(12345), + new Number[] { 12345, + 12345L, new java.math.BigDecimal("12345.4999"), new java.math.BigDecimal("12344.5001"), }, @@ -213,19 +213,19 @@ public class BigNumberFormatTest extends CoreTestFmwk { "12.346E3"); /*For ICU compatibility [Richard/GCL]*/ expect(NumberFormat.getScientificInstance(Locale.FRANCE), - new Double(12345.678901), + 12345.678901d, "1,2345678901E4"); expect(new DecimalFormat("##0.####E0", US), - new Double(789.12345e-9), + 789.12345e-9d, "789.12E-9"); expect(new DecimalFormat("##0.####E0", US), - new Double(780.e-9), + 780.e-9d, "780E-9"); expect(new DecimalFormat(".###E0", US), - new Double(45678), + 45678d, ".457E5"); expect(new DecimalFormat(".###E0", US), - new Long(0), + 0L, ".0E0"); expect(new DecimalFormat[] { new DecimalFormat("#E0", US), new DecimalFormat("##E0", US), @@ -234,7 +234,7 @@ public class BigNumberFormatTest extends CoreTestFmwk { new DecimalFormat("00E0", US), new DecimalFormat("000E0", US), }, - new Long(45678000), + 45678000L, new String[] { "4.5678E7", "45.678E6", "4567.8E4", @@ -244,19 +244,19 @@ public class BigNumberFormatTest extends CoreTestFmwk { } ); expect(new DecimalFormat("###E0", US), - new Object[] { new Double(0.0000123), "12.3E-6", - new Double(0.000123), "123E-6", + new Object[] { 0.0000123d, "12.3E-6", + 0.000123d, "123E-6", new java.math.BigDecimal("0.00123"), "1.23E-3", // Cafe VM messes up Double(0.00123) - new Double(0.0123), "12.3E-3", - new Double(0.123), "123E-3", - new Double(1.23), "1.23E0", - new Double(12.3), "12.3E0", - new Double(123), "123E0", - new Double(1230), "1.23E3", + 0.0123d, "12.3E-3", + 0.123d, "123E-3", + 1.23d, "1.23E0", + 12.3d, "12.3E0", + 123d, "123E0", + 1230d, "1.23E3", }); expect(new DecimalFormat("0.#E+00", US), - new Object[] { new Double(0.00012), "1.2E-04", - new Long(12000), "1.2E+04", + new Object[] { 0.00012d, "1.2E-04", + 12000L, "1.2E+04", }); } @@ -266,26 +266,26 @@ public class BigNumberFormatTest extends CoreTestFmwk { public void TestPad() { DecimalFormatSymbols US = new DecimalFormatSymbols(Locale.US); expect(new DecimalFormat("*^##.##", US), - new Object[] { new Long(0), "^^^^0", - new Double(-1.3), "^-1.3", + new Object[] { 0L, "^^^^0", + -1.3d, "^-1.3", } ); expect(new DecimalFormat("##0.0####E0*_ 'g-m/s^2'", US), - new Object[] { new Long(0), "0.0E0______ g-m/s^2", - new Double(1.0/3), "333.333E-3_ g-m/s^2", + new Object[] { 0L, "0.0E0______ g-m/s^2", + 1.0d/3, "333.333E-3_ g-m/s^2", } ); expect(new DecimalFormat("##0.0####*_ 'g-m/s^2'", US), - new Object[] { new Long(0), "0.0______ g-m/s^2", - new Double(1.0/3), "0.33333__ g-m/s^2", + new Object[] { 0L, "0.0______ g-m/s^2", + 1.0d/3, "0.33333__ g-m/s^2", } ); expect(new DecimalFormat("*x#,###,###,##0.00;*x(#,###,###,##0.00)", US), new Object[] { - new Long(-100), "xxxxxxxx(100.00)", - new Long(-1000), "xxxxxx(1,000.00)", - new Long(-1000000), "xx(1,000,000.00)", - new Long(-1000000000), "(1,000,000,000.00)", + -100L, "xxxxxxxx(100.00)", + -1000L, "xxxxxx(1,000.00)", + -1000000L, "xx(1,000,000.00)", + -1000000000L, "(1,000,000,000.00)", }); } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java index 10cc547bc9e..9b5d6512809 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/DateFormatRegressionTest.java @@ -988,7 +988,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what + "=" + s); first = s.charAt(0); if(first(kHindiZero+9)) { - errln(what + "- wrong digit, got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + "- wrong digit, got " + s + " (integer digit value " + Integer.valueOf(first)); } } @@ -999,7 +999,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what + ": " + s); first = s.charAt(0); if(first(kArabicZero+9)) { - errln(what + " wrong digit, got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + " wrong digit, got " + s + " (integer digit value " + Integer.valueOf(first)); } } @@ -1010,7 +1010,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what + ": " + s); first = s.charAt(0); if(first(kArabicZero+9)) { - errln(what + " wrong digit but got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + " wrong digit but got " + s + " (integer digit value " + Integer.valueOf(first)); } } { @@ -1020,7 +1020,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what + ": " + s); first = s.charAt(0); if(first(kLatinZero+9)) { - errln(what + " wrong digit but got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + " wrong digit but got " + s + " (integer digit value " + Integer.valueOf(first)); } } @@ -1031,7 +1031,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what+ ": " + s); first = s.charAt(0); if(first(kArabicZero+9)) { - errln(what + " wrong digit but got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + " wrong digit but got " + s + " (integer digit value " + Integer.valueOf(first)); } } @@ -1042,7 +1042,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what+ ": " + s); first = s.charAt(0); if(first(kArabicZero+9)) { - errln(what + " wrong digit but got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + " wrong digit but got " + s + " (integer digit value " + Integer.valueOf(first)); } } @@ -1053,7 +1053,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk { logln(what+ ": " + s); first = s.charAt(0); if(first(kArabicZero+9)) { - errln(what + " wrong digit but got " + s + " (integer digit value " + new Integer(first).toString()); + errln(what + " wrong digit but got " + s + " (integer digit value " + Integer.valueOf(first)); } } } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/IntlTestDateFormatAPIC.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/IntlTestDateFormatAPIC.java index 243d60b1f07..0e3295ffd25 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/IntlTestDateFormatAPIC.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/IntlTestDateFormatAPIC.java @@ -47,7 +47,7 @@ public class IntlTestDateFormatAPIC extends CoreTestFmwk { // compile-time name hiding. Date dateObj = new Date(0); - Number numObj = new Double(3.1415926535897932384626433832795); + Number numObj = 3.1415926535897932384626433832795; StringBuffer strBuffer = new StringBuffer(""); String str; FieldPosition fpos = new FieldPosition(0); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/MessageRegressionTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/MessageRegressionTest.java index 21b60153867..71638854c14 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/MessageRegressionTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/MessageRegressionTest.java @@ -133,7 +133,7 @@ public class MessageRegressionTest extends CoreTestFmwk { try { logln("Apply with pattern : " + pattern1); messageFormatter.applyPattern(pattern1); - Object[] paramArray = {new Integer(7)}; + Object[] paramArray = {7}; String tempBuffer = messageFormatter.format(paramArray); if (!tempBuffer.equals("Impossible {1} has occurred -- status code is 7 and message is {2}.")) errln("Tests arguments < substitution failed"); @@ -468,7 +468,7 @@ public class MessageRegressionTest extends CoreTestFmwk { errln("argument0: \"" + objs[0] + "\""); mf.setLocale(Locale.US); mf.applyPattern("{0,number,#.##}, {0,number,#.#}"); - Object[] oldobjs = {new Double(3.1415)}; + Object[] oldobjs = {3.1415d}; String result = mf.format( oldobjs ); logln("pattern: \"" + mf.toPattern() + "\""); logln("text for parsing: \"" + result + "\""); @@ -476,7 +476,7 @@ public class MessageRegressionTest extends CoreTestFmwk { if (!result.equals("3.14, 3.1")) errln("result = " + result); Object[] newobjs = mf.parse(result, new ParsePosition(0)); - // newobjs now equals {new Double(3.1)} + // newobjs now equals {Double.valueOf(3.1)} if (((Number)newobjs[0]).doubleValue() != 3.1) // was (Double) [alan] errln( "newobjs[0] = " + newobjs[0]); } @@ -495,7 +495,7 @@ public class MessageRegressionTest extends CoreTestFmwk { ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart); form1.setFormat(1, fileform); form2.setFormat(0, fileform); - Object[] testArgs = {new Long(12373), "MyDisk"}; + Object[] testArgs = {12373L, "MyDisk"}; logln(form1.format(testArgs)); logln(form2.format(testArgs)); } @@ -547,7 +547,7 @@ public class MessageRegressionTest extends CoreTestFmwk { }; for (int i=0; i<3; i++) { - String out = mf.format(new Object[]{new Integer(i)}); + String out = mf.format(new Object[]{i}); if (SUFFIX[i] == null) { if (!out.equals(PREFIX[i])) errln("" + i + ": Got \"" + out + "\"; Want \"" + PREFIX[i] + "\""); @@ -678,7 +678,7 @@ public class MessageRegressionTest extends CoreTestFmwk { logln("Apply with pattern : " + pattern1); messageFormatter.applyPattern(pattern1); HashMap paramsMap = new HashMap(); - paramsMap.put("arg0", new Integer(7)); + paramsMap.put("arg0", 7); String tempBuffer = messageFormatter.format(paramsMap); if (!tempBuffer.equals("Impossible {arg1} has occurred -- status code is 7 and message is {arg2}.")) errln("Tests arguments < substitution failed"); @@ -701,7 +701,7 @@ public class MessageRegressionTest extends CoreTestFmwk { logln("Apply with pattern : " + pattern2); messageFormatter.applyPattern(pattern2); paramsMap.clear(); - paramsMap.put("ARG_ZERO", new Integer(7)); + paramsMap.put("ARG_ZERO", 7); tempBuffer = messageFormatter.format(paramsMap); if (!tempBuffer.equals("Double ' Quotes 7 test and quoted {ARG_ONE} test plus 'other {ARG_TWO} stuff'.")) errln("quote format test (w/ params) failed."); @@ -829,7 +829,7 @@ public class MessageRegressionTest extends CoreTestFmwk { mf.setLocale(Locale.US); mf.applyPattern("{" + argName + ",number,#.##}, {" + argName + ",number,#.#}"); Map oldobjs = new HashMap(); - oldobjs.put(argName, new Double(3.1415)); + oldobjs.put(argName, 3.1415d); String result = mf.format( oldobjs ); logln("pattern: \"" + mf.toPattern() + "\""); logln("text for parsing: \"" + result + "\""); @@ -837,7 +837,7 @@ public class MessageRegressionTest extends CoreTestFmwk { if (!result.equals("3.14, 3.1")) errln("result = " + result); Map newobjs = mf.parseToMap(result, new ParsePosition(0)); - // newobjs now equals {new Double(3.1)} + // newobjs now equals {Double.valueOf(3.1)} if (((Number)newobjs.get(argName)).doubleValue() != 3.1) // was (Double) [alan] errln( "newobjs.get(argName) = " + newobjs.get(argName)); }{ // Taken from Test4105380(). @@ -852,7 +852,7 @@ public class MessageRegressionTest extends CoreTestFmwk { form2.setFormat(0, fileform); Map testArgs = new HashMap(); testArgs.put("diskName", "MyDisk"); - testArgs.put("numberOfFiles", new Long(12373)); + testArgs.put("numberOfFiles", 12373L); logln(form1.format(testArgs)); logln(form2.format(testArgs)); }{ // Taken from test4293229(). diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/NumberFormatRoundTripTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/NumberFormatRoundTripTest.java index 13e3405cb9a..e822f933c95 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/NumberFormatRoundTripTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/NumberFormatRoundTripTest.java @@ -147,11 +147,11 @@ public class NumberFormatRoundTripTest extends CoreTestFmwk { } private void _test(NumberFormat fmt, double value) { - _test(fmt, new Double(value)); + _test(fmt, Double.valueOf(value)); } private void _test(NumberFormat fmt, long value) { - _test(fmt, new Long(value)); + _test(fmt, Long.valueOf(value)); } private void _test(NumberFormat fmt, Number value) { @@ -163,7 +163,7 @@ public class NumberFormatRoundTripTest extends CoreTestFmwk { else s = fmt.format(value.longValue()); - Number n = new Double(0); + Number n = 0d; boolean show = verbose; if (DEBUG) logln( diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatTest.java index 3a0204930e2..94e353694f3 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatTest.java @@ -35,18 +35,18 @@ public class PluralFormatTest extends CoreTestFmwk { // Create example outputs for all supported locales. /* System.out.println("\n" + localeIDs); - String lastValue = (String) changes.get(new Integer(0)); + String lastValue = (String) changes.get(Integer.valueOf(0)); int lastNumber = 0; for (int i = 1; i < 199; ++i) { - if (changes.get(new Integer(i)) != null) { + if (changes.get(Integer.valueOf(i)) != null) { if (lastNumber == i-1) { System.out.println(lastNumber + ": " + lastValue); } else { System.out.println(lastNumber + "... " + (i-1) + ": " + lastValue); } lastNumber = i; - lastValue = (String) changes.get(new Integer(i)); + lastValue = (String) changes.get(Integer.valueOf(i)); } } System.out.println(lastNumber + "..." + 199 + ": " + lastValue); @@ -56,7 +56,7 @@ public class PluralFormatTest extends CoreTestFmwk { try { PluralFormat plf = new PluralFormat(new ULocale(locales[i]), testPattern); log("plf: " + plf); - String expected = changes.get(new Integer(0)); + String expected = changes.get(0); for (int n = 0; n < 200; ++n) { String value = changes.get(n); if (value != null) { @@ -75,8 +75,8 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestOneFormLocales() { String localeIDs = "ja,ko,tr,vi"; String testPattern = "other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); helperTestRules(localeIDs, testPattern, changes); } @@ -85,10 +85,10 @@ public class PluralFormatTest extends CoreTestFmwk { String localeIDs = "bem,da,de,el,en,eo,es,et,fi,fo,he,it,mr,nb,nl,nn,no,pt_PT,sv,af,bg,ca,eu,fur,fy,ha,ku,lb,ml," + "nah,ne,om,or,pap,ps,so,sq,sw,ta,te,tk,ur,mn,gsw,rm"; String testPattern = "one{one} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "other"); helperTestRules(localeIDs, testPattern, changes); } @@ -96,9 +96,9 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestSingular01Locales() { String localeIDs = "ff,fr,kab,gu,pa,pt,zu,bn"; String testPattern = "one{one} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "one"); - changes.put(new Integer(2), "other"); + Map changes = new HashMap<>(); + changes.put(0, "one"); + changes.put(2, "other"); helperTestRules(localeIDs, testPattern, changes); } @@ -106,22 +106,22 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestZeroSingularLocales() { String localeIDs = "lv"; String testPattern = "zero{zero} one{one} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "zero"); - changes.put(new Integer(1), "one"); + Map changes = new HashMap<>(); + changes.put(0, "zero"); + changes.put(1, "one"); for (int i = 2; i < 20; ++i) { if (i < 10) { - changes.put(new Integer(i), "other"); + changes.put(i, "other"); } else { - changes.put(new Integer(i), "zero"); + changes.put(i, "zero"); } - changes.put(new Integer(i*10), "zero"); + changes.put(i*10, "zero"); if (i == 11) { - changes.put(new Integer(i*10 + 1), "zero"); - changes.put(new Integer(i*10 + 2), "zero"); + changes.put(i * 10 + 1, "zero"); + changes.put(i * 10 + 2, "zero"); } else { - changes.put(new Integer(i*10 + 1), "one"); - changes.put(new Integer(i*10 + 2), "other"); + changes.put(i * 10 + 1, "one"); + changes.put(i * 10 + 2, "other"); } } helperTestRules(localeIDs, testPattern, changes); @@ -131,11 +131,11 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestSingularDual() { String localeIDs = "ga"; String testPattern = "one{one} two{two} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "two"); - changes.put(new Integer(3), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "two"); + changes.put(3, "other"); helperTestRules(localeIDs, testPattern, changes); } @@ -143,14 +143,14 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestSingularZeroSome() { String localeIDs = "ro"; String testPattern = "few{few} one{one} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "few"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "few"); - changes.put(new Integer(20), "other"); - changes.put(new Integer(101), "few"); - changes.put(new Integer(102), "few"); - changes.put(new Integer(120), "other"); + Map changes = new HashMap<>(); + changes.put(0, "few"); + changes.put(1, "one"); + changes.put(2, "few"); + changes.put(20, "other"); + changes.put(101, "few"); + changes.put(102, "few"); + changes.put(120, "other"); helperTestRules(localeIDs, testPattern, changes); } @@ -158,18 +158,18 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestSpecial12_19() { String localeIDs = "lt"; String testPattern = "one{one} few{few} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "few"); - changes.put(new Integer(10), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "few"); + changes.put(10, "other"); for (int i = 2; i < 20; ++i) { if (i == 11) { continue; } - changes.put(new Integer(i*10 + 1), "one"); - changes.put(new Integer(i*10 + 2), "few"); - changes.put(new Integer((i+1)*10), "other"); + changes.put(i * 10 + 1, "one"); + changes.put(i * 10 + 2, "few"); + changes.put((i + 1) * 10, "other"); } helperTestRules(localeIDs, testPattern, changes); } @@ -178,18 +178,18 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestPaucalExcept11_14() { String localeIDs = "hr,sr,uk"; String testPattern = "one{one} few{few} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "few"); - changes.put(new Integer(5), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "few"); + changes.put(5, "other"); for (int i = 2; i < 20; ++i) { if (i == 11) { continue; } - changes.put(new Integer(i*10 + 1), "one"); - changes.put(new Integer(i*10 + 2), "few"); - changes.put(new Integer(i*10 + 5), "other"); + changes.put(i * 10 + 1, "one"); + changes.put(i * 10 + 2, "few"); + changes.put(i * 10 + 5, "other"); } helperTestRules(localeIDs, testPattern, changes); } @@ -198,7 +198,7 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestPaucalRu() { String localeIDs = "ru"; String testPattern = "one{one} many{many} other{other}"; - Map changes = new HashMap(); + Map changes = new HashMap<>(); for (int i = 0; i < 200; i+=10) { if (i == 10 || i == 110) { put(i, 0, 9, "many", changes); @@ -229,11 +229,11 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestSingularPaucal() { String localeIDs = "cs,sk"; String testPattern = "one{one} few{few} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "few"); - changes.put(new Integer(5), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "few"); + changes.put(5, "other"); helperTestRules(localeIDs, testPattern, changes); } @@ -241,17 +241,17 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestPaucal1_234() { String localeIDs = "pl"; String testPattern = "one{one} few{few} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "few"); - changes.put(new Integer(5), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "few"); + changes.put(5, "other"); for (int i = 2; i < 20; ++i) { if (i == 11) { continue; } - changes.put(new Integer(i*10 + 2), "few"); - changes.put(new Integer(i*10 + 5), "other"); + changes.put(i * 10 + 2, "few"); + changes.put(i * 10 + 5, "other"); } helperTestRules(localeIDs, testPattern, changes); } @@ -260,16 +260,16 @@ public class PluralFormatTest extends CoreTestFmwk { public void TestPaucal1_2_34() { String localeIDs = "sl"; String testPattern = "one{one} two{two} few{few} other{other}"; - Map changes = new HashMap(); - changes.put(new Integer(0), "other"); - changes.put(new Integer(1), "one"); - changes.put(new Integer(2), "two"); - changes.put(new Integer(3), "few"); - changes.put(new Integer(5), "other"); - changes.put(new Integer(101), "one"); - changes.put(new Integer(102), "two"); - changes.put(new Integer(103), "few"); - changes.put(new Integer(105), "other"); + Map changes = new HashMap<>(); + changes.put(0, "other"); + changes.put(1, "one"); + changes.put(2, "two"); + changes.put(3, "few"); + changes.put(5, "other"); + changes.put(101, "one"); + changes.put(102, "two"); + changes.put(103, "few"); + changes.put(105, "other"); helperTestRules(localeIDs, testPattern, changes); } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatUnitTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatUnitTest.java index f0755f0b977..89339fe959d 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatUnitTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/PluralFormatUnitTest.java @@ -84,7 +84,7 @@ public class PluralFormatUnitTest extends CoreTestFmwk { String result = numberFmt.format(n*n); for (int k = 0; k < plFmts.length; ++k) { sb.delete(0, sb.length()); - String pfResult = plFmts[k].format(Long.valueOf(n*n), sb, ignore).toString(); + String pfResult = plFmts[k].format((long)(n*n), sb, ignore).toString(); TestFmwk.assertEquals("PluralFormat's output is not as expected", result, pfResult); } } @@ -306,7 +306,7 @@ public class PluralFormatUnitTest extends CoreTestFmwk { MessageFormat pfmt = new MessageFormat("The disk ''{0}'' contains {1, plural, one {one ''''{1, number, #.0}'''' widget} other {# widgets}}."); logln(""); for (int i = 0; i < 3; ++i) { - args[1] = new Integer(i); + args[1] = i; logln(pfmt.format(args)); } /* ICU 4.8 returns null instead of a choice/plural/select Format object diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/SelectFormatAPITest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/SelectFormatAPITest.java index dd2e1c17f1f..5d00c35ba85 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/SelectFormatAPITest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/SelectFormatAPITest.java @@ -151,7 +151,7 @@ public class SelectFormatAPITest extends CoreTestFmwk { boolean threwException = false; try { StringBuffer buf = new StringBuffer("AppendHere-"); - selFmt1.format(Integer.valueOf(0), buf, new FieldPosition(0)); + selFmt1.format(0, buf, new FieldPosition(0)); } catch (IllegalArgumentException e) { threwException = true; } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/TimeUnitTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/TimeUnitTest.java index 14447fc5229..c447ae54f73 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/TimeUnitTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/format/TimeUnitTest.java @@ -402,7 +402,7 @@ public class TimeUnitTest extends CoreTestFmwk { public void TestFormat() { TimeUnitFormat tuf = new TimeUnitFormat(); try { - tuf.format(new Integer("1"), null, null); + tuf.format(Integer.parseInt("1"), null, null); errln("TimeUnitFormat.format(Object,StringBuffer,FieldPosition) " + "was suppose to return an exception because the Object " + "parameter was not of type TimeUnitAmount."); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UCharacterCompare.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UCharacterCompare.java index db4be1b9d25..62a9f19013f 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UCharacterCompare.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UCharacterCompare.java @@ -96,8 +96,8 @@ public final class UCharacterCompare if (UCharacter.toLowerCase(i) != Character.toLowerCase(i)) trackDifference(p, i, "toLowerCase()", Integer.toHexString(UCharacter.toLowerCase(i)), Integer .toHexString(Character.toLowerCase(i))); - if (!UCharacter.toString(i).equals(new Character(i).toString())) - trackDifference(p, i, "toString()", UCharacter.toString(i), new Character(i).toString()); + if (!UCharacter.toString(i).equals(Character.valueOf(i).toString())) + trackDifference(p, i, "toString()", UCharacter.toString(i), Character.valueOf(i).toString()); if (UCharacter.toTitleCase(i) != Character.toTitleCase(i)) trackDifference(p, i, "toTitleCase()", Integer.toHexString(UCharacter.toTitleCase(i)), Integer .toHexString(Character.toTitleCase(i))); @@ -209,9 +209,9 @@ public final class UCharacterCompare throws Exception { if (m_hashtable_.containsKey(method)) { Integer value = m_hashtable_.get(method); - m_hashtable_.put(method, new Integer(value.intValue() + 1)); + m_hashtable_.put(method, value.intValue() + 1); } else - m_hashtable_.put(method, new Integer(1)); + m_hashtable_.put(method, 1); String temp = Integer.toHexString(ch); StringBuffer s = new StringBuffer(temp); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UnicodeSetTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UnicodeSetTest.java index 0509401358a..74c35ca4bde 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UnicodeSetTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/lang/UnicodeSetTest.java @@ -841,17 +841,7 @@ public class UnicodeSetTest extends CoreTestFmwk { } } } - - static final Integer - I_ANY = new Integer(SortedSetRelation.ANY), - I_CONTAINS = new Integer(SortedSetRelation.CONTAINS), - I_DISJOINT = new Integer(SortedSetRelation.DISJOINT), - I_NO_B = new Integer(SortedSetRelation.NO_B), - I_ISCONTAINED = new Integer(SortedSetRelation.ISCONTAINED), - I_EQUALS = new Integer(SortedSetRelation.EQUALS), - I_NO_A = new Integer(SortedSetRelation.NO_A), - I_NONE = new Integer(SortedSetRelation.NONE); - + @Test public void TestSetRelation() { @@ -885,8 +875,8 @@ public class UnicodeSetTest extends CoreTestFmwk { SortedSet jset = new TreeSet(); for (int i = 0; i < size*2; i += 2) { // only even values - iset.add(new Integer(i)); - jset.add(new Integer(i)); + iset.add(i); + jset.add(i); } int iterations = 1000000 / size; @@ -896,12 +886,12 @@ public class UnicodeSetTest extends CoreTestFmwk { CheckSpeed(iset, jset, "when a = b", iterations); - iset.add(new Integer(size + 1)); // add odd value in middle + iset.add(size + 1); // add odd value in middle CheckSpeed(iset, jset, "when a contains b", iterations); CheckSpeed(jset, iset, "when b contains a", iterations); - jset.add(new Integer(size - 1)); // add different odd value in middle + jset.add(size - 1); // add different odd value in middle CheckSpeed(jset, iset, "when a, b are disjoint", iterations); } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/message2/Mf2IcuTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/message2/Mf2IcuTest.java index 8742fed04fe..ce077d8e467 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/message2/Mf2IcuTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/message2/Mf2IcuTest.java @@ -37,7 +37,7 @@ public class Mf2IcuTest extends CoreTestFmwk { @Test public void testStaticFormat() { - Map arguments = Args.of("planet", new Integer(7), "when", new Date(871068000000L), "what", + Map arguments = Args.of("planet", 7, "when", new Date(871068000000L), "what", "a disturbance in the Force"); assertEquals("format", "At 12:20:00\u202FPM on Aug 8, 1997, there was a disturbance in the Force on planet 7.", @@ -52,9 +52,9 @@ public class Mf2IcuTest extends CoreTestFmwk { @Test public void testSimpleFormat() { - Map testArgs1 = Args.of("fileCount", new Integer(0), "diskName", "MyDisk"); - Map testArgs2 = Args.of("fileCount", new Integer(1), "diskName", "MyDisk"); - Map testArgs3 = Args.of("fileCount", new Integer(12), "diskName", "MyDisk"); + Map testArgs1 = Args.of("fileCount", 0, "diskName", "MyDisk"); + Map testArgs2 = Args.of("fileCount", 1, "diskName", "MyDisk"); + Map testArgs3 = Args.of("fileCount", 12, "diskName", "MyDisk"); MessageFormatter form = MessageFormatter.builder() .setPattern("{The disk \"{$diskName}\" contains {$fileCount} file(s).}") diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntHashtable.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntHashtable.java index 63d90efb410..c866c32215d 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntHashtable.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntHashtable.java @@ -24,14 +24,14 @@ public class IntHashtable { public void put(int key, int value) { if (value == defaultValue) { - table.remove(new Integer(key)); + table.remove(key); } else { - table.put(new Integer(key), new Integer(value)); + table.put(key, value); } } public int get(int key) { - Integer value = table.get(new Integer(key)); + Integer value = table.get(key); if (value == null) return defaultValue; return value.intValue(); } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntStringHashtable.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntStringHashtable.java index dc8f67803a4..006b3f5f06f 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntStringHashtable.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/IntStringHashtable.java @@ -24,14 +24,14 @@ public class IntStringHashtable { public void put(int key, String value) { if (value == defaultValue) { - table.remove(new Integer(key)); + table.remove(key); } else { - table.put(new Integer(key), value); + table.put(key, value); } } public String get(int key) { - String value = table.get(new Integer(key)); + String value = table.get(key); if (value == null) return defaultValue; return value; } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/LongHashtable.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/LongHashtable.java index 9ccfacb4d47..ea533d3d988 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/LongHashtable.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/normalizer/LongHashtable.java @@ -23,14 +23,14 @@ public class LongHashtable { public void put(long key, int value) { if (value == defaultValue) { - table.remove(new Long(key)); + table.remove(key); } else { - table.put(new Long(key), new Integer(value)); + table.put(key, value); } } public int get(long key) { - Integer value = table.get(new Long(key)); + Integer value = table.get(key); if (value == null) return defaultValue; return value.intValue(); } diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/IDNAConformanceTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/IDNAConformanceTest.java index 7a65fb18a10..c263039daf0 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/IDNAConformanceTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/IDNAConformanceTest.java @@ -292,7 +292,7 @@ public class IDNAConformanceTest extends CoreTestFmwk { //if met "=====", it means this item is finished if ("=====".equals(tempStr)) { //set them into result, using records number as key - result.put(new Long(records), hashItem); + result.put((long)records, hashItem); //create another hash item and continue hashItem = new HashMap(); records++; diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/NamePrepTransform.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/NamePrepTransform.java index 4870d949169..5b662041f9d 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/NamePrepTransform.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/stringprep/NamePrepTransform.java @@ -187,7 +187,7 @@ public class NamePrepTransform { try { Class cls = Class.forName("com.ibm.icu.text.Transliterator"); Method createMethod = cls.getMethod("createFromRules", String.class, String.class, Integer.TYPE); - translitInstance = createMethod.invoke(null, id, rule, Integer.valueOf(direction)); + translitInstance = createMethod.invoke(null, id, rule, direction); translitMethod = cls.getMethod("transliterate", String.class); } catch (Throwable e) { return false; diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneAliasTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneAliasTest.java index 29ad92e6ac5..f069e9ff0a9 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneAliasTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneAliasTest.java @@ -246,8 +246,8 @@ public class TimeZoneAliasTest extends CoreTestFmwk { private int maxOffset; private int minRecentOffset; private int maxRecentOffset; - private List inflectionPoints = new ArrayList(); - private Set purportedAliases = new TreeSet(); + private List inflectionPoints = new ArrayList<>(); + private Set purportedAliases = new TreeSet<>(); private Zone(String id) { // for internal use only; use make instead! zone = TimeZone.getTimeZone(id); @@ -266,7 +266,7 @@ public class TimeZoneAliasTest extends CoreTestFmwk { if (zone.getOffset(lastDate) < zone.getOffset(endDate2)) lastDate = endDate2; maxRecentOffset = minRecentOffset = minOffset = maxOffset = zone.getOffset(lastDate); - inflectionPoints.add(new Long(lastDate)); + inflectionPoints.add(lastDate); int lastOffset = zone.getOffset(endDate); long lastInflection = endDate; @@ -291,12 +291,12 @@ public class TimeZoneAliasTest extends CoreTestFmwk { high = mid; } } - inflectionPoints.add(new Long(low)); + inflectionPoints.add(low); lastInflection = low; } lastOffset = currentOffset; } - inflectionPoints.add(new Long(startDate)); // just to cap it off for comparisons. + inflectionPoints.add(startDate); // just to cap it off for comparisons. } // we assume that places will not convert time zones then back within one day diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneRegressionTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneRegressionTest.java index f3461ec9cad..1870f89be74 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneRegressionTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneRegressionTest.java @@ -257,8 +257,8 @@ public class TimeZoneRegressionTest extends CoreTestFmwk { dow, millis); tzRawOffset = testTZ.getRawOffset(); - tzOffsetFloat = new Float((float)tzOffset/(float)3600000); - tzRawOffsetFloat = new Float((float)tzRawOffset/(float)3600000); + tzOffsetFloat = (float)tzOffset/3600000f; + tzRawOffsetFloat = (float)tzRawOffset/3600000f; Date testDate = testCal.getTime(); diff --git a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneTest.java b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneTest.java index 15e14b66fd3..a8942514ecb 100644 --- a/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneTest.java +++ b/icu4j/main/core/src/test/java/com/ibm/icu/dev/test/timezone/TimeZoneTest.java @@ -376,25 +376,25 @@ public class TimeZoneTest extends CoreTestFmwk // todo: check to see whether we can test for all of pst, pdt, pt Object[] DATA = { // z and zzzz - Boolean.FALSE, new Integer(TimeZone.SHORT), "PST", - Boolean.TRUE, new Integer(TimeZone.SHORT), "PDT", - Boolean.FALSE, new Integer(TimeZone.LONG), "Pacific Standard Time", - Boolean.TRUE, new Integer(TimeZone.LONG), "Pacific Daylight Time", + Boolean.FALSE, TimeZone.SHORT, "PST", + Boolean.TRUE, TimeZone.SHORT, "PDT", + Boolean.FALSE, TimeZone.LONG, "Pacific Standard Time", + Boolean.TRUE, TimeZone.LONG, "Pacific Daylight Time", // v and vvvv - Boolean.FALSE, new Integer(TimeZone.SHORT_GENERIC), "PT", - Boolean.TRUE, new Integer(TimeZone.SHORT_GENERIC), "PT", - Boolean.FALSE, new Integer(TimeZone.LONG_GENERIC), "Pacific Time", - Boolean.TRUE, new Integer(TimeZone.LONG_GENERIC), "Pacific Time", + Boolean.FALSE, TimeZone.SHORT_GENERIC, "PT", + Boolean.TRUE, TimeZone.SHORT_GENERIC, "PT", + Boolean.FALSE, TimeZone.LONG_GENERIC, "Pacific Time", + Boolean.TRUE, TimeZone.LONG_GENERIC, "Pacific Time", // z and ZZZZ - Boolean.FALSE, new Integer(TimeZone.SHORT_GMT), "-0800", - Boolean.TRUE, new Integer(TimeZone.SHORT_GMT), "-0700", - Boolean.FALSE, new Integer(TimeZone.LONG_GMT), "GMT-08:00", - Boolean.TRUE, new Integer(TimeZone.LONG_GMT), "GMT-07:00", + Boolean.FALSE, TimeZone.SHORT_GMT, "-0800", + Boolean.TRUE, TimeZone.SHORT_GMT, "-0700", + Boolean.FALSE, TimeZone.LONG_GMT, "GMT-08:00", + Boolean.TRUE, TimeZone.LONG_GMT, "GMT-07:00", // V and VVVV - Boolean.FALSE, new Integer(TimeZone.SHORT_COMMONLY_USED), "PST", - Boolean.TRUE, new Integer(TimeZone.SHORT_COMMONLY_USED), "PDT", - Boolean.FALSE, new Integer(TimeZone.GENERIC_LOCATION), "Los Angeles Time", - Boolean.TRUE, new Integer(TimeZone.GENERIC_LOCATION), "Los Angeles Time", + Boolean.FALSE, TimeZone.SHORT_COMMONLY_USED, "PST", + Boolean.TRUE, TimeZone.SHORT_COMMONLY_USED, "PDT", + Boolean.FALSE, TimeZone.GENERIC_LOCATION, "Los Angeles Time", + Boolean.TRUE, TimeZone.GENERIC_LOCATION, "Los Angeles Time", }; for (int i=0; i res = new HashMap(); for (int i = 0; i < strings.length; i++) { if (strings[i].length() != 0) { - res.put(strings[i], Integer.valueOf(i)); + res.put(strings[i], i); } } return res; diff --git a/icu4j/main/localespi/src/test/java/com/ibm/icu/dev/test/localespi/NumberFormatTest.java b/icu4j/main/localespi/src/test/java/com/ibm/icu/dev/test/localespi/NumberFormatTest.java index 4e60d2be1ee..35fd5760941 100644 --- a/icu4j/main/localespi/src/test/java/com/ibm/icu/dev/test/localespi/NumberFormatTest.java +++ b/icu4j/main/localespi/src/test/java/com/ibm/icu/dev/test/localespi/NumberFormatTest.java @@ -158,6 +158,8 @@ public class NumberFormatTest extends TestFmwk { 124578.369D, }; + // We want to really be sure that we test those exact classes. + @SuppressWarnings("UnnecessaryBoxing") Object[] TEST_NUMBERS = { Byte.valueOf((byte)13), Integer.valueOf(3961), diff --git a/icu4j/main/translit/src/main/java/com/ibm/icu/text/AnyTransliterator.java b/icu4j/main/translit/src/main/java/com/ibm/icu/text/AnyTransliterator.java index 87e98af7fdf..dec3a5e1958 100644 --- a/icu4j/main/translit/src/main/java/com/ibm/icu/text/AnyTransliterator.java +++ b/icu4j/main/translit/src/main/java/com/ibm/icu/text/AnyTransliterator.java @@ -184,7 +184,7 @@ class AnyTransliterator extends Transliterator { } } - Integer key = Integer.valueOf(source); + Integer key = source; Transliterator t = cache.get(key); if (t == null) { String sourceName = UScript.getName(source); diff --git a/icu4j/main/translit/src/main/java/com/ibm/icu/text/Transliterator.java b/icu4j/main/translit/src/main/java/com/ibm/icu/text/Transliterator.java index 8a561dd26a6..48d47e3ad4f 100644 --- a/icu4j/main/translit/src/main/java/com/ibm/icu/text/Transliterator.java +++ b/icu4j/main/translit/src/main/java/com/ibm/icu/text/Transliterator.java @@ -1507,7 +1507,7 @@ public abstract class Transliterator implements StringTransform { MessageFormat format = new MessageFormat( bundle.getString(RB_DISPLAY_NAME_PATTERN)); // Construct the argument array - Object[] args = new Object[] { Integer.valueOf(2), stv[0], stv[1] }; + Object[] args = new Object[] { 2, stv[0], stv[1] }; // Use display names for the scripts, if they exist for (int j=1; j<=2; ++j) { diff --git a/icu4j/main/translit/src/test/java/com/ibm/icu/dev/test/translit/UnicodeMapTest.java b/icu4j/main/translit/src/test/java/com/ibm/icu/dev/test/translit/UnicodeMapTest.java index e3e809dce5d..9dbf040ad77 100644 --- a/icu4j/main/translit/src/test/java/com/ibm/icu/dev/test/translit/UnicodeMapTest.java +++ b/icu4j/main/translit/src/test/java/com/ibm/icu/dev/test/translit/UnicodeMapTest.java @@ -282,7 +282,7 @@ public class UnicodeMapTest extends TestFmwk { logln(unicodeMap.toString()); } for (int i = start; i <= end; ++i) { - hashMap.put(new Integer(i), value); + hashMap.put(i, value); } if (!hasSameValues(unicodeMap, hashMap)) { errln("Failed at " + count); @@ -293,7 +293,7 @@ public class UnicodeMapTest extends TestFmwk { private boolean hasSameValues(UnicodeMap unicodeMap, HashMap hashMap) { for (int i = 0; i < MODIFY_TEST_LIMIT; ++i) { Object unicodeMapValue = unicodeMap.getValue(i); - Object hashMapValue = hashMap.get(new Integer(i)); + Object hashMapValue = hashMap.get(i); if (unicodeMapValue != hashMapValue) { return false; } diff --git a/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/NormalizerPerformanceTest.java b/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/NormalizerPerformanceTest.java index 9d083f99758..24ed994a78a 100644 --- a/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/NormalizerPerformanceTest.java +++ b/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/NormalizerPerformanceTest.java @@ -657,7 +657,7 @@ public class NormalizerPerformanceTest extends PerfTest { try { if (sun) { - normalizerArgs = new Object[] { null, null, new Integer(0) }; + normalizerArgs = new Object[] { null, null, 0 }; normalizerArgs[1] = normalizer.getField(compose ? "COMPOSE" : "DECOMP").get(null); normalizerMethod = normalizer.getMethod("normalize", new Class[] { String.class, normalizerArgs[1].getClass(), int.class }); // sun.text.Normalizer.normalize(line, compose diff --git a/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/UnicodeSetPerf.java b/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/UnicodeSetPerf.java index a8e95e1ad35..402af037d0e 100644 --- a/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/UnicodeSetPerf.java +++ b/icu4j/perf-tests/src/main/java/com/ibm/icu/dev/test/perf/UnicodeSetPerf.java @@ -25,7 +25,7 @@ public class UnicodeSetPerf extends PerfTest { UnicodeSet testChars; UnicodeSetIterator it; UnicodeSet us; - HashSet hs; + HashSet hs; public static void main(String[] args) throws Exception { new UnicodeSetPerf().run(args); @@ -41,7 +41,7 @@ public class UnicodeSetPerf extends PerfTest { testChars = new UnicodeSet(pattern); it = new UnicodeSetIterator(testChars); us = new UnicodeSet(); - hs = new HashSet(); + hs = new HashSet<>(); } PerfTest.Function testUnicodeSetAdd() { @@ -72,7 +72,7 @@ public class UnicodeSetPerf extends PerfTest { int n=0; while (it.nextRange()) { for (int cp = it.codepoint; cp <= it.codepointEnd; ++cp) { - hs.add(new Integer(cp)); + hs.add(cp); ++n; } } @@ -108,13 +108,13 @@ public class UnicodeSetPerf extends PerfTest { hs.clear(); it.reset(); while (it.next()) { - hs.add(new Integer(it.codepoint)); + hs.add(it.codepoint); } return new PerfTest.Function() { public void call() { int temp = 0; for (int cp = 0; cp <= 0x10FFFF; ++cp) { - if (hs.contains(new Integer(cp))) { + if (hs.contains(cp)) { temp += cp; } } @@ -146,14 +146,13 @@ public class UnicodeSetPerf extends PerfTest { hs.clear(); it.reset(); while (it.next()) { - hs.add(new Integer(it.codepoint)); + hs.add(it.codepoint); } return new PerfTest.Function() { public void call() { int temp = 0; - Iterator itr = hs.iterator(); - while (itr.hasNext()) { - temp += ((Integer)itr.next()).intValue(); + for (Integer value : hs) { + temp += value; } } diff --git a/icu4j/pom.xml b/icu4j/pom.xml index 7ff0dd887a2..77136fb910d 100644 --- a/icu4j/pom.xml +++ b/icu4j/pom.xml @@ -642,6 +642,43 @@ + + + errorprone + + + + org.apache.maven.plugins + maven-compiler-plugin + + ${maven.compiler.source} + ${maven.compiler.target} + UTF-8 + + true + + -XDcompilePolicy=simple + + -Xplugin:ErrorProne -XepAllErrorsAsWarnings + + + + com.google.errorprone + error_prone_core + 2.25.0 + + + + + + + + diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/BIG5Tool.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/BIG5Tool.java index 745d0e3c725..8b25f04a925 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/BIG5Tool.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/BIG5Tool.java @@ -206,7 +206,7 @@ public class BIG5Tool { ChEl c = (ChEl)encounteredChars[i]; cumulativeChars += c.occurences; cumulativePercent = cumulativeChars*100/totalMbcsChars; - charList.add(new Integer(c.charCode)); + charList.add(c.charCode); } Object [] sortedChars = charList.toArray(); Arrays.sort(sortedChars); diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/EUCTool.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/EUCTool.java index 367aa19e11d..29420878beb 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/EUCTool.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/mbcs/EUCTool.java @@ -206,7 +206,7 @@ public class EUCTool { ChEl c = (ChEl)encounteredChars[i]; cumulativeChars += c.occurences; cumulativePercent = cumulativeChars*100/totalMbcsChars; - charList.add(new Integer(c.charCode)); + charList.add(c.charCode); } Object [] sortedChars = charList.toArray(); Arrays.sort(sortedChars); diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/InputFile.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/InputFile.java index a26b80f7f35..19c750d2d6a 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/InputFile.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/InputFile.java @@ -140,7 +140,7 @@ public class InputFile implements NGramList.NGramKeyMapper value += (bytes[b] & 0xFF); } - return new Integer(value); + return value; } public byte[] encode(char[] chars) diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/StatisticsTool.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/StatisticsTool.java index 6d51dd32ce2..5d8699c6460 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/StatisticsTool.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/charsetdet/sbcs/StatisticsTool.java @@ -289,7 +289,7 @@ public class StatisticsTool implements NGramParser.NGramParserClient, NGramList. writeStatistics(statKeys, false); if (inputFile.getVisualOrder()) { - ArrayList reversed = new ArrayList(statKeys.size()); + ArrayList reversed = new ArrayList(statKeys.size()); for (Iterator it = statKeys.iterator(); it.hasNext();) { Integer key = (Integer) it.next(); @@ -301,7 +301,7 @@ public class StatisticsTool implements NGramParser.NGramParserClient, NGramList. k >>= 8; } - reversed.add(new Integer(r)); + reversed.add(r); } Collections.sort(reversed); diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/layout/ScriptRunModuleWriter.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/layout/ScriptRunModuleWriter.java index ff11e6c8f07..96d4631c227 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/layout/ScriptRunModuleWriter.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/layout/ScriptRunModuleWriter.java @@ -65,7 +65,7 @@ public class ScriptRunModuleWriter extends ScriptModuleWriter } for (int record = 0; record < recordCount; record += 1) { - scriptRangeOffsets[scriptData.getRecord(record).scriptCode() - minScript].addElement(new Integer(record)); + scriptRangeOffsets[scriptData.getRecord(record).scriptCode() - minScript].addElement(record); } output.println(); diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java index 14130c20302..41f925382a6 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/localeconverter/CalculateCRC32.java @@ -83,6 +83,6 @@ public class CalculateCRC32 { } public byte [] toBytes() { - return new BigInteger(new Integer(cachedCRC).toString()).toByteArray(); + return new BigInteger(Integer.valueOf(cachedCRC).toString()).toByteArray(); } } diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/timezone/ICUZDump.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/timezone/ICUZDump.java index 3c8d6af0de3..f2a80e5abd3 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/timezone/ICUZDump.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/timezone/ICUZDump.java @@ -145,7 +145,7 @@ public class ICUZDump { public int getOffset(long time) { try { Method method = tzobj.getClass().getMethod("getOffset", new Class[] {long.class}); - Object result = method.invoke(tzobj, new Object[] {new Long(time)}); + Object result = method.invoke(tzobj, new Object[] {time}); return ((Integer)result).intValue(); } catch (Exception e) { e.printStackTrace(); diff --git a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/translit/UnicodeSetCloseOver.java b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/translit/UnicodeSetCloseOver.java index 99156f50afb..a1a270199ad 100644 --- a/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/translit/UnicodeSetCloseOver.java +++ b/icu4j/tools/misc/src/main/java/com/ibm/icu/dev/tool/translit/UnicodeSetCloseOver.java @@ -167,7 +167,7 @@ class UnicodeSetCloseOver { // and a string of length 3. v.clear(); for (int j=0; j