ICU-22675 Migrate from deprecated boxed primitive constructors to their replacements

This commit is contained in:
Mihai Nita 2024-02-23 23:42:33 -08:00
parent 394341edba
commit 201af462fc
95 changed files with 537 additions and 517 deletions
icu4j
main
charset/src/test/java/com/ibm/icu/dev/test/charset
collate/src/test/java/com/ibm/icu/dev/test
common_tests/src/test/java/com/ibm/icu/dev/test
core/src
framework/src/test/java/com/ibm/icu/dev/test
localespi/src
main/java/com/ibm/icu/impl/jdkadapter
test/java/com/ibm/icu/dev/test/localespi
translit/src
main/java/com/ibm/icu/text
test/java/com/ibm/icu/dev/test/translit
perf-tests/src/main/java/com/ibm/icu/dev/test/perf
pom.xml
tools/misc/src/main/java/com/ibm/icu/dev/tool
tools
multi/proj/icu4jscan/src/com/ibm/icu/dev/scan
release/java/src/main/java/com/ibm/icu/dev/tools/docs

View file

@ -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();

View file

@ -993,7 +993,7 @@ public class AlphabeticIndexTest extends TestFmwk {
List<String> 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));

View file

@ -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" };

View file

@ -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

View file

@ -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]);
}
}
}

View file

@ -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<kwVals.length;n++) {
logln(new Integer(n).toString() + ": " + kwVals[n]);
logln(Integer.valueOf(n).toString() + ": " + kwVals[n]);
if(DEFAULT_NAME.equals(kwVals[n])) {
errln("getKeywordValues for collation returned 'default' in the list.");
} else if(STANDARD_NAME.equals(kwVals[n])) {
@ -169,16 +169,16 @@ public final class ICUResourceBundleCollationTest extends TestFmwk {
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);
}
}
}

View file

@ -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) {

View file

@ -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

View file

@ -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)) {

View file

@ -538,7 +538,7 @@ public class NumberFormatTest extends CoreTestFmwk {
for (int i=0; i<DATA.length; ++i) {
String locale = DATA[i][0];
String pat = DATA[i][1];
Double numberToBeFormat = new Double(DATA[i][2]);
Double numberToBeFormat = Double.valueOf(DATA[i][2]);
DecimalFormatSymbols sym = new DecimalFormatSymbols(new ULocale(locale));
for (int j=1; j<=3; ++j) {
// j represents the number of currency sign in the pattern.
@ -721,7 +721,7 @@ public class NumberFormatTest extends CoreTestFmwk {
ULocale save = ULocale.getDefault();
ULocale.setDefault(ULocale.US);
MeasureFormat curFmt = MeasureFormat.getCurrencyFormat();
String strBuf = curFmt.format(new CurrencyAmount(new Float(1234.56), Currency.getInstance("USD")));
String strBuf = curFmt.format(new CurrencyAmount(Float.valueOf(1234.56f), Currency.getInstance("USD")));
try {
CurrencyAmount parsedVal = (CurrencyAmount)curFmt.parseObject(strBuf);
@ -794,7 +794,7 @@ public class NumberFormatTest extends CoreTestFmwk {
continue;
}
String localeString = DATA[i][0];
Double numberToBeFormat = new Double(DATA[i][1]);
Double numberToBeFormat = Double.valueOf(DATA[i][1]);
String currencyISOCode = DATA[i][2];
ULocale locale = new ULocale(localeString);
NumberFormat numFmt = NumberFormat.getInstance(locale, k);
@ -1275,7 +1275,7 @@ public class NumberFormatTest extends CoreTestFmwk {
new DecimalFormat("00E0", US),
new DecimalFormat("000E0", US),
},
new Long(45678000),
Long.valueOf(45678000),
new String[] { "4.5678E7",
"45.678E6",
"4567.8E4",
@ -1296,15 +1296,15 @@ public class NumberFormatTest extends CoreTestFmwk {
expect(new DecimalFormat("000E0", US), 45678000, "457E5");
/*
expect(new DecimalFormat("###E0", US, status),
new Object[] { new Double(0.0000123), "12.3E-6",
new Double(0.000123), "123E-6",
new Double(0.00123), "1.23E-3",
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",
new Object[] { Double.valueOf(0.0000123), "12.3E-6",
Double.valueOf(0.000123), "123E-6",
Double.valueOf(0.00123), "1.23E-3",
Double.valueOf(0.0123), "12.3E-3",
Double.valueOf(0.123), "123E-3",
Double.valueOf(1.23), "1.23E0",
Double.valueOf(12.3), "12.3E0",
Double.valueOf(123), "123E0",
Double.valueOf(1230), "1.23E3",
});
!
! Unroll this test into individual tests below...
@ -1321,8 +1321,8 @@ public class NumberFormatTest extends CoreTestFmwk {
expect2(new DecimalFormat("###E0", US), 1230.0, "1.23E3");
/*
expect(new DecimalFormat("0.#E+00", US, status),
new Object[] { new Double(0.00012), "1.2E-04",
new Long(12000), "1.2E+04",
new Object[] { Double.valueOf(0.00012), "1.2E-04",
Long.valueOf(12000), "1.2E+04",
});
!
! Unroll this test into individual tests below...
@ -1555,7 +1555,7 @@ public class NumberFormatTest extends CoreTestFmwk {
public void TestScientific2() {
// jb 2552
DecimalFormat fmt = (DecimalFormat)NumberFormat.getCurrencyInstance();
Number num = new Double(12.34);
Number num = 12.34d;
expect(fmt, num, "$12.34");
fmt.setScientificNotation(true);
expect(fmt, num, "$1.23E1");
@ -2539,7 +2539,7 @@ public class NumberFormatTest extends CoreTestFmwk {
@Test
public void TestBigDecimalRounding() {
String figure = "50.000000004";
Double dbl = new Double(figure);
Double dbl = Double.valueOf(figure);
BigDecimal dec = new BigDecimal(figure);
DecimalFormat f = (DecimalFormat) NumberFormat.getInstance();
@ -2654,20 +2654,20 @@ public class NumberFormatTest extends CoreTestFmwk {
/** Format-Parse test (convenience) */
public void expect2(NumberFormat fmt, double n, String exp) {
expect2(fmt, new Double(n), exp);
expect2(fmt, Double.valueOf(n), exp);
}
/** RBNF Format-Parse test (convenience) */
public void expect3(NumberFormat fmt, double n, String exp) {
expect3(fmt, new Double(n), exp);
expect3(fmt, Double.valueOf(n), exp);
}
/** Format-Parse test (convenience) */
public void expect2(NumberFormat fmt, long n, String exp) {
expect2(fmt, new Long(n), exp);
expect2(fmt, Long.valueOf(n), exp);
}
/** RBNF Format-Parse test (convenience) */
public void expect3(NumberFormat fmt, long n, String exp) {
expect3(fmt, new Long(n), exp);
expect3(fmt, Long.valueOf(n), exp);
}
/** Format test */
@ -2742,12 +2742,12 @@ public class NumberFormatTest extends CoreTestFmwk {
/** Format test (convenience) */
public void expect(NumberFormat fmt, double n, String exp) {
expect(fmt, new Double(n), exp);
expect(fmt, Double.valueOf(n), exp);
}
/** Format test (convenience) */
public void expect(NumberFormat fmt, long n, String exp) {
expect(fmt, new Long(n), exp);
expect(fmt, Long.valueOf(n), exp);
}
/** Parse test */
@ -2794,12 +2794,12 @@ public class NumberFormatTest extends CoreTestFmwk {
/** Parse test (convenience) */
public void expect(NumberFormat fmt, String str, double n) {
expect(fmt, str, new Double(n));
expect(fmt, str, Double.valueOf(n));
}
/** Parse test (convenience) */
public void expect(NumberFormat fmt, String str, long n) {
expect(fmt, str, new Long(n));
expect(fmt, str, Long.valueOf(n));
}
/** Parse test */
@ -3261,7 +3261,7 @@ public class NumberFormatTest extends CoreTestFmwk {
// Tests when "if (number instanceof Long)" is true
try {
nf.format(new Long("0"), sb, fp);
nf.format(Long.valueOf("0"), sb, fp);
} catch (Exception e) {
errln("NumberFormat.format(Object number, ...) was not suppose to "
+ "return an exception for a Long object. Error: " + e);
@ -3735,13 +3735,13 @@ public class NumberFormatTest extends CoreTestFmwk {
} catch (NullPointerException ex) {
}
try {
ca = new CurrencyAmount(new Integer(0), (Currency) null);
ca = new CurrencyAmount(Integer.valueOf(0), (Currency) null);
errln("NullPointerException should have been thrown.");
} catch (NullPointerException ex) {
}
ca = new CurrencyAmount(new Integer(0), Currency.getInstance(new ULocale("ja_JP")));
cb = new CurrencyAmount(new Integer(1), Currency.getInstance(new ULocale("ja_JP")));
ca = new CurrencyAmount(Integer.valueOf(0), Currency.getInstance(new ULocale("ja_JP")));
cb = new CurrencyAmount(Integer.valueOf(1), Currency.getInstance(new ULocale("ja_JP")));
if (ca.equals(null)) {
errln("Comparison should return false.");
}
@ -3894,41 +3894,41 @@ public class NumberFormatTest extends CoreTestFmwk {
{
ULocale.US, // ULocale - null for default locale
"#.##", // Pattern
Integer.valueOf(BigDecimal.ROUND_DOWN), // Rounding Mode or null (implicit)
Double.valueOf(0.0d), // Rounding increment, Double or BigDecimal, or null (implicit)
Double.valueOf(123.4567d), // Input value, Long, Double, BigInteger or BigDecimal
BigDecimal.ROUND_DOWN, // Rounding Mode or null (implicit)
0.0d, // Rounding increment, Double or BigDecimal, or null (implicit)
123.4567d, // Input value, Long, Double, BigInteger or BigDecimal
"123.45" // Expected result, null for exception
},
{
ULocale.US,
"#.##",
null,
Double.valueOf(0.1d),
Double.valueOf(123.4567d),
0.1d,
123.4567d,
"123.5"
},
{
ULocale.US,
"#.##",
Integer.valueOf(BigDecimal.ROUND_DOWN),
Double.valueOf(0.1d),
Double.valueOf(123.4567d),
BigDecimal.ROUND_DOWN,
0.1d,
123.4567d,
"123.4"
},
{
ULocale.US,
"#.##",
Integer.valueOf(BigDecimal.ROUND_UNNECESSARY),
BigDecimal.ROUND_UNNECESSARY,
null,
Double.valueOf(123.4567d),
123.4567d,
null
},
{
ULocale.US,
"#.##",
Integer.valueOf(BigDecimal.ROUND_DOWN),
BigDecimal.ROUND_DOWN,
null,
Long.valueOf(1234),
1234L,
"1234"
},
};
@ -4837,7 +4837,7 @@ public class NumberFormatTest extends CoreTestFmwk {
v1.add(new FieldContainer(11, 12, NumberFormat.Field.DECIMAL_SEPARATOR));
v1.add(new FieldContainer(12, 15, NumberFormat.Field.FRACTION));
Number number = new Double(123456789.9753);
Number number = 123456789.9753d;
ULocale usLoc = new ULocale("en-US");
DecimalFormatSymbols US = new DecimalFormatSymbols(usLoc);
@ -4936,7 +4936,7 @@ public class NumberFormatTest extends CoreTestFmwk {
@Test
public void TestMissingFieldPositionsCurrency() {
DecimalFormat formatter = (DecimalFormat) NumberFormat.getCurrencyInstance(ULocale.US);
Number number = new Double(92314587.66);
Number number = 92314587.66d;
String result = "$92,314,587.66";
checkFormatWithField("currency", formatter, number, result,
@ -4955,7 +4955,7 @@ public class NumberFormatTest extends CoreTestFmwk {
public void TestMissingFieldPositionsNegativeDouble() {
// test for exponential fields with double
DecimalFormatSymbols us_symbols = new DecimalFormatSymbols(ULocale.US);
Number number = new Double(-12345678.90123);
Number number = -12345678.90123d;
DecimalFormat formatter = new DecimalFormat("0.#####E+00", us_symbols);
String numFmtted = formatter.format(number);
@ -4977,7 +4977,7 @@ public class NumberFormatTest extends CoreTestFmwk {
public void TestMissingFieldPositionsPerCent() {
// Check PERCENT
DecimalFormat percentFormat = (DecimalFormat) NumberFormat.getPercentInstance(ULocale.US);
Number number = new Double(-0.986);
Number number = -0.986d;
String numberFormatted = percentFormat.format(number);
checkFormatWithField("sign", percentFormat, number, numberFormatted,
NumberFormat.Field.SIGN, 0, 1);
@ -4992,7 +4992,7 @@ public class NumberFormatTest extends CoreTestFmwk {
// Check PERCENT with more digits
DecimalFormatSymbols us_symbols = new DecimalFormatSymbols(ULocale.US);
DecimalFormat fmtPercent = new DecimalFormat("0.#####%", us_symbols);
Number number = new Double(-0.986);
Number number = -0.986d;
String numFmtted = fmtPercent.format(number);
checkFormatWithField("sign", fmtPercent, number, numFmtted,
@ -5012,7 +5012,7 @@ public class NumberFormatTest extends CoreTestFmwk {
// Check PERMILLE
DecimalFormatSymbols us_symbols = new DecimalFormatSymbols(ULocale.US);
DecimalFormat fmtPerMille = new DecimalFormat("0.######‰", us_symbols);
Number numberPermille = new Double(-0.98654);
Number numberPermille = -0.98654d;
String numFmtted = fmtPerMille.format(numberPermille);
checkFormatWithField("sign", fmtPerMille, numberPermille, numFmtted,
@ -5050,7 +5050,7 @@ public class NumberFormatTest extends CoreTestFmwk {
@Test
public void TestMissingFieldPositionsNegativeLong() {
Number number = new Long("-123456789987654321");
Number number = Long.valueOf("-123456789987654321");
DecimalFormatSymbols us_symbols = new DecimalFormatSymbols(ULocale.US);
DecimalFormat formatter = new DecimalFormat("0.#####E+0", us_symbols);
String longFmtted = formatter.format(number);
@ -5074,7 +5074,7 @@ public class NumberFormatTest extends CoreTestFmwk {
// Check complex positive;negative pattern.
DecimalFormatSymbols us_symbols = new DecimalFormatSymbols(ULocale.US);
DecimalFormat fmtPosNegSign = new DecimalFormat("+0.####E+00;-0.#######E+0", us_symbols);
Number positiveExp = new Double("9876543210");
Number positiveExp = Double.valueOf("9876543210");
String posExpFormatted = fmtPosNegSign.format(positiveExp);
checkFormatWithField("sign", fmtPosNegSign, positiveExp, posExpFormatted,
@ -6113,8 +6113,8 @@ public class NumberFormatTest extends CoreTestFmwk {
df.setParseNoExponent(true);
assertEquals("Parse no exponent getter is broken", true, df.isParseNoExponent());
Number result2 = df.parse("123E4");
assertEquals("Exponent did not parse before setParseNoExponent", result1, new Long(1230000));
assertEquals("Exponent parsed after setParseNoExponent", result2, new Long(123));
assertEquals("Exponent did not parse before setParseNoExponent", result1, 1230000L);
assertEquals("Exponent parsed after setParseNoExponent", result2, 123L);
}
@Test

View file

@ -392,7 +392,7 @@ public class NumberRegressionTests extends CoreTestFmwk {
{
DecimalFormat df = new DecimalFormat();
String str = "0.1234";
Double d1 = new Double(str);
Double d1 = Double.parseDouble(str);
Number d2 = df.parse(str, new ParsePosition(0));
logln(d1.toString());
if (d2.doubleValue() != d1.doubleValue())
@ -849,7 +849,7 @@ public class NumberRegressionTests extends CoreTestFmwk {
DecimalFormat fmt = new DecimalFormat("#,##0.00");
StringBuffer formatted = new StringBuffer();
FieldPosition field = new FieldPosition(0);
Double num = new Double(1234.5);
Double num = 1234.5;
fmt.format(num, formatted, field);
if (field.getBeginIndex() != 0 && field.getEndIndex() != 5)
errln("Format 1234.5 failed. Begin index: " + field.getBeginIndex() + " End index: " + field.getEndIndex());
@ -1388,13 +1388,13 @@ public class NumberRegressionTests extends CoreTestFmwk {
{
ParsePosition ppos = new ParsePosition(0);
Number result = df.parse("-0.0", ppos);
assertEquals("Should parse to double -0.0", new Double(-0.0), result);
assertEquals("Should parse to double -0.0", -0.0d, result);
}
df.setParseIntegerOnly(true);
{
ParsePosition ppos = new ParsePosition(0);
Number result = df.parse("-0.0", ppos);
assertEquals("Should parse to an integer type, not a double", new Long(0), result);
assertEquals("Should parse to an integer type, not a double", 0L, result);
}
}
@ -1672,10 +1672,10 @@ public class NumberRegressionTests extends CoreTestFmwk {
@Test
public void Test4217661() {
Object[] DATA = {
new Double(0.001), "0",
new Double(1.001), "1",
new Double(0.006), "0.01",
new Double(1.006), "1.01",
0.001d, "0",
1.001d, "1",
0.006d, "0.01",
1.006d, "1.01",
};
NumberFormat fmt = NumberFormat.getInstance(Locale.US);
fmt.setMaximumFractionDigits(2);
@ -1869,7 +1869,7 @@ class MyNumberFormat extends NumberFormat {
}
@Override
public Number parse(String text, ParsePosition parsePosition) {
return new Integer(0);
return 0;
}
@Override
public StringBuffer format(java.math.BigDecimal number, StringBuffer toAppendTo, FieldPosition pos) {

View file

@ -1316,7 +1316,7 @@ public class RbnfTest extends CoreTestFmwk {
// Tests when "if (!(that instanceof RuleBasedNumberFormat))" is true
RuleBasedNumberFormat rbnf = new RuleBasedNumberFormat("dummy");
if (rbnf.equals("dummy") ||
rbnf.equals(new Character('a')) ||
rbnf.equals('a') ||
rbnf.equals(new Object()) ||
rbnf.equals(-1) ||
rbnf.equals(0) ||

View file

@ -154,7 +154,7 @@ public class TestMessageFormat extends CoreTestFmwk {
public void TestPattern() // aka PatternTest()
{
Object testArgs[] = {
new Double(1), new Double(3456),
1d, 3456d,
"Disk", new Date(1000000000L)
};
String testCases[] = {
@ -272,7 +272,7 @@ public class TestMessageFormat extends CoreTestFmwk {
public void TestStaticFormat()
{
Object arguments[] = {
new Integer(7),
7,
new Date(871068000000L),
"a disturbance in the Force"
};
@ -288,9 +288,9 @@ public class TestMessageFormat extends CoreTestFmwk {
@Test
public void TestSimpleFormat()
{
Object testArgs1[] = {new Integer(0), "MyDisk"};
Object testArgs2[] = {new Integer(1), "MyDisk"};
Object testArgs3[] = {new Integer(12), "MyDisk"};
Object testArgs1[] = {0, "MyDisk"};
Object testArgs2[] = {1, "MyDisk"};
Object testArgs3[] = {12, "MyDisk"};
MessageFormat form = new MessageFormat(
"The disk \"{1}\" contains {0} file(s).");
@ -326,21 +326,21 @@ public class TestMessageFormat extends CoreTestFmwk {
FieldPosition ignore = new FieldPosition(FieldPosition_DONT_CARE);
StringBuffer string = new StringBuffer();
Object testArgs1[] = {new Integer(0), "MyDisk"};
Object testArgs1[] = {0, "MyDisk"};
form.format(testArgs1, string, ignore);
assertEquals("format#1",
"The disk \"MyDisk\" contains no files.",
string.toString());
string.setLength(0);
Object testArgs2[] = {new Integer(1), "MyDisk"};
Object testArgs2[] = {1, "MyDisk"};
form.format(testArgs2, string, ignore);
assertEquals("format#2",
"The disk \"MyDisk\" contains one file.",
string.toString());
string.setLength(0);
Object testArgs3[] = {new Integer(1273), "MyDisk"};
Object testArgs3[] = {1273, "MyDisk"};
form.format(testArgs3, string, ignore);
assertEquals("format#3",
"The disk \"MyDisk\" contains 1,273 files.",
@ -434,7 +434,7 @@ public class TestMessageFormat extends CoreTestFmwk {
public void TestSetLocale()
{
Object arguments[] = {
new Double(456.83),
456.83d,
new Date(871068000000L),
"deposit"
};
@ -819,9 +819,9 @@ public class TestMessageFormat extends CoreTestFmwk {
final Object ARGS[] = {
new Date(10000000000000L),
new Integer(1303),
new Integer(1202),
new Double(1303.0/1202 - 1),
1303,
1202,
1303.0d/1202 - 1,
"Glimmung",
"the printers",
"Nick",
@ -903,7 +903,7 @@ public class TestMessageFormat extends CoreTestFmwk {
public void TestSetGetFormats()
{
Object arguments[] = {
new Double(456.83),
456.83d,
new Date(871068000000L),
"deposit"
};
@ -1119,7 +1119,7 @@ public class TestMessageFormat extends CoreTestFmwk {
gotException = false;
try {
Object args[] = {new Long(42)};
Object args[] = {42L};
msg.format(args, new StringBuffer(), new FieldPosition(FieldPosition_DONT_CARE));
} catch (IllegalArgumentException e) {
gotException = true;
@ -1132,7 +1132,7 @@ public class TestMessageFormat extends CoreTestFmwk {
gotException = false;
try {
Object args[] = {new Long(42)};
Object args[] = {42L};
msg.format((Object) args, new StringBuffer(), new FieldPosition(FieldPosition_DONT_CARE));
} catch (IllegalArgumentException e) {
gotException = true;
@ -1290,7 +1290,7 @@ public class TestMessageFormat extends CoreTestFmwk {
"{0, plural, one {{0, number,C''est #,##0.0# fichier}} " +
"other {Ce sont # fichiers}} dans la liste.",
new ULocale("fr"));
Object objArray[] = {new Long(0)};
Object objArray[] = {0L};
HashMap objMap = new HashMap();
objMap.put("argument", objArray[0]);
String result = msgFmt.format(objArray);
@ -1315,7 +1315,7 @@ public class TestMessageFormat extends CoreTestFmwk {
"{argument, plural, one{C''est # fichier} other {Ce " +
"sont # fichiers}} dans la liste.",
new ULocale("fr"));
Object objArray[] = {new Long(0)};
Object objArray[] = {0L};
HashMap objMap = new HashMap();
objMap.put("argument", objArray[0]);
String result = mfNum.format(objArray);
@ -1338,7 +1338,7 @@ public class TestMessageFormat extends CoreTestFmwk {
"are {argument, number,###.0} zavoda} other{are # " +
"zavodov}} in the directory.",
new ULocale("uk"));
Object objArray[] = {new Long(4)};
Object objArray[] = {4L};
HashMap objMap = new HashMap();
objMap.put("argument", objArray[0]);
String result = mfNum.format(objArray);
@ -1587,7 +1587,7 @@ public class TestMessageFormat extends CoreTestFmwk {
dateFormat.setTimeZone(TimeZone.getTimeZone("Etc/GMT"));
ms.setFormatByArgumentName("date", dateFormat);
Map map = new HashMap();
map.put("number", new Integer(1234));
map.put("number", 1234);
map.put("date", new Date(0,0,0));
String result = ms.format(map);
assertEquals("setFormatByArgumentName", "1234.000 year:99 month:12 day:31", result);
@ -1617,15 +1617,15 @@ public class TestMessageFormat extends CoreTestFmwk {
ChoiceFormat fileform = new ChoiceFormat(filelimits, filepart);
msgfmts[2].setFormat(0, fileform);
Object[] args0 = new Object[] { "tmp", new Date(1184777888000L), new Integer(15), new Integer(2) };
Object[] args0 = new Object[] { "tmp", new Date(1184777888000L), 15, 2 };
HashMap args1 = new HashMap();
args1.put("arg0", "tmp");
args1.put("arg1", new Date(1184777888000L));
args1.put("arg2", new Integer(15));
args1.put("arg3", new Integer(2));
args1.put("arg2", 15);
args1.put("arg3", 2);
Object[] args2 = new Object[] { new Integer(34) };
Object[] args2 = new Object[] { 34 };
Object[] args = { args0, args1, args2 };
@ -1638,18 +1638,18 @@ public class TestMessageFormat extends CoreTestFmwk {
new AttributedString(expectedStrings[1]), new AttributedString(expectedStrings[2]) };
// Add expected attributes to the expectedAttributedStrings[0]
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, new Integer(3), 4, 7);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, new Integer(0), 16, 19);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, new Integer(2), 30, 32);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, 3, 4, 7);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, 0, 16, 19);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, 2, 30, 32);
expectedAttributedStrings[0].addAttribute(NumberFormat.Field.INTEGER, NumberFormat.Field.INTEGER, 30, 32);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, new Integer(1), 53, 63);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, 1, 53, 63);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.HOUR1, DateFormat.Field.HOUR1, 53, 54);
//expectedAttributedStrings[0].addAttribute(DateFormat.Field.TIME_SEPARATOR, DateFormat.Field.TIME_SEPARATOR, 54, 55);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.MINUTE, DateFormat.Field.MINUTE, 55, 57);
//expectedAttributedStrings[0].addAttribute(DateFormat.Field.TIME_SEPARATOR, DateFormat.Field.TIME_SEPARATOR, 57, 58);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.SECOND, DateFormat.Field.SECOND, 58, 60);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.AM_PM, DateFormat.Field.AM_PM, 61, 63);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, new Integer(1), 67, 79);
expectedAttributedStrings[0].addAttribute(MessageFormat.Field.ARGUMENT, 1, 67, 79);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.MONTH, DateFormat.Field.MONTH, 67, 70);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.DAY_OF_MONTH, DateFormat.Field.DAY_OF_MONTH, 71, 73);
expectedAttributedStrings[0].addAttribute(DateFormat.Field.YEAR, DateFormat.Field.YEAR, 75, 79);
@ -1672,7 +1672,7 @@ public class TestMessageFormat extends CoreTestFmwk {
expectedAttributedStrings[1].addAttribute(DateFormat.Field.YEAR, DateFormat.Field.YEAR, 75, 79);
// Add expected attributes to the expectedAttributedStrings[2]
expectedAttributedStrings[2].addAttribute(MessageFormat.Field.ARGUMENT, new Integer(0), 20, 28);
expectedAttributedStrings[2].addAttribute(MessageFormat.Field.ARGUMENT, 0, 20, 28);
expectedAttributedStrings[2].addAttribute(NumberFormat.Field.INTEGER, NumberFormat.Field.INTEGER, 20, 22);
for (int i = 0; i < msgfmts.length; i++) {
@ -1877,7 +1877,7 @@ public class TestMessageFormat extends CoreTestFmwk {
m.applyPattern("x { _oOo_ , number , integer } y");
Map<String, Object> map = new HashMap<String, Object>();
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());

View file

@ -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) {

View file

@ -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);
}

View file

@ -767,7 +767,7 @@ public class SerializableTestUtility {
@Override
public Object[] getTestObjects() {
Mf2DataModel.OrderedMap<String, Object> 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[] {

View file

@ -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);
}
}
}

View file

@ -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);

View file

@ -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]

View file

@ -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;

View file

@ -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
}

View file

@ -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<Integer>() {

View file

@ -503,7 +503,7 @@ public final class ZoneMeta {
if (singleZone == null) {
Set<String> 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;

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -40,12 +40,12 @@ public class LocaleExtensions {
CALENDAR_JAPANESE = new LocaleExtensions();
CALENDAR_JAPANESE._id = "u-ca-japanese";
CALENDAR_JAPANESE._map = new TreeMap<Character, Extension>();
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<Character, Extension>();
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<Character, Extension>();
_map = new TreeMap<>();
if (hasExtension) {
for (Entry<CaseInsensitiveChar, String> 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<String> 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<String> 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;
}

View file

@ -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

View file

@ -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);
}
/**

View file

@ -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));
}
/**

View file

@ -19,7 +19,7 @@ public class UnlocalizedNumberFormatter extends NumberFormatterSettings<Unlocali
/** Base constructor; called during startup only. Sets the threshold to the default value of 3. */
UnlocalizedNumberFormatter() {
super(null, KEY_THRESHOLD, new Long(3));
super(null, KEY_THRESHOLD, 3L);
}
UnlocalizedNumberFormatter(NumberFormatterSettings<?> parent, int key, Object value) {

View file

@ -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<args.length) {
arg=args[argNumber];

View file

@ -895,13 +895,13 @@ final class NFRule {
* character not consumed by matching the text against this rule
* (if this rule doesn't match the text at all, the parse position
* if left unchanged (presumably at 0) and the function returns
* new Long(0)).
* Long.valueOf(0)).
* @param isFractionRule True if this rule is contained within a
* fraction rule set. This is only used if the rule has no
* substitutions.
* @return If this rule matched the text, this is the rule's base value
* combined appropriately with the results of parsing the substitutions.
* If nothing matched, this is new Long(0) and the parse position is
* If nothing matched, this is Long.valueOf(0) and the parse position is
* left unchanged. The result will be an instance of Long if the
* result is an integer and Double otherwise. The result is never null.
*/
@ -1052,9 +1052,9 @@ final class NFRule {
// return the result as a Long if possible, or as a Double
if (result == (long)result) {
return Long.valueOf((long)result);
return (long) result;
} else {
return new Double(result);
return result;
}
}
@ -1119,7 +1119,7 @@ final class NFRule {
* consider rules with base values lower than this value.
* @return If there's a match, this is the result of composing
* baseValue with the result of matching the substitution. Otherwise,
* this is new Long(0). It's never null. If the result is an integer,
* this is Long.valueOf(0). It's never null. If the result is an integer,
* this will be an instance of Long; otherwise, it's an instance of
* Double.
*/

View file

@ -748,7 +748,7 @@ final class NFRuleSet {
* will be an instance of Long if it's an integral value; otherwise,
* it will be an instance of Double. This function always returns
* a valid object: If nothing matched the input string at all,
* this function returns new Long(0), and the parse position is
* this function returns Long.valueOf(0), and the parse position is
* left unchanged.
*/
public Number parse(String text, ParsePosition parsePosition, double upperBound, int nonNumericalExecutedRuleMask) {

View file

@ -421,7 +421,7 @@ abstract class NFSubstitution {
* @return If there's a match, this is the result of composing
* baseValue with whatever was returned from matching the
* characters. This will be either a Long or a Double. If there's
* no match this is new Long(0) (not null), and parsePosition
* no match this is Long.valueOf(0) (not null), and parsePosition
* is left unchanged.
*/
public Number doParse(String text, ParsePosition parsePosition, double baseValue,
@ -484,9 +484,9 @@ abstract class NFSubstitution {
// the result.
result = composeRuleValue(result, baseValue);
if (result == (long)result) {
return Long.valueOf((long)result);
return (long) result;
} else {
return new Double(result);
return result;
}
// if the parse was UNsuccessful, return 0
@ -1028,9 +1028,9 @@ class ModulusSubstitution extends NFSubstitution {
result = composeRuleValue(result, baseValue);
if (result == (long)result) {
return Long.valueOf((long)result);
return (long) result;
} else {
return new Double(result);
return result;
}
} else {
return tempResult;
@ -1311,7 +1311,7 @@ class FractionalPartSubstitution extends NFSubstitution {
* @param lenientParse If true, try matching the text as numerals if
* matching as words doesn't work
* @return If the match was successful, the current partial parse
* result; otherwise new Long(0). The result is either a Long or
* result; otherwise Long.valueOf(0). The result is either a Long or
* a Double.
*/
@Override
@ -1360,7 +1360,7 @@ class FractionalPartSubstitution extends NFSubstitution {
result = fq.toDouble();
result = composeRuleValue(result, baseValue);
return new Double(result);
return result;
}
}
@ -1693,7 +1693,7 @@ class NumeratorSubstitution extends NFSubstitution {
--zeroCount;
}
// d is now our true denominator
result = new Double(n/(double)d);
result = (double)n/(double)d;
}
return result;

View file

@ -751,7 +751,7 @@ class RBBITableBuilder {
for (n=0; n<fDStates.size(); n++) { // For each state s (row in the state table)
RBBIStateDescriptor sd = fDStates.get(n);
if (sd.fPositions.contains(tagNode)) { // if s include the tag node t
sd.fTagVals.add(Integer.valueOf(tagNode.fVal));
sd.fTagVals.add(tagNode.fVal);
}
}
}
@ -799,15 +799,15 @@ class RBBITableBuilder {
// We will need this as a default, for rule sets with no explicit tagging,
// or with explicit tagging of {0}.
if (fRB.fRuleStatusVals.size() == 0) {
fRB.fRuleStatusVals.add(Integer.valueOf(1)); // Num of statuses in group
fRB.fRuleStatusVals.add(Integer.valueOf(0)); // and our single status of zero
fRB.fRuleStatusVals.add(1); // Num of statuses in group
fRB.fRuleStatusVals.add(0); // and our single status of zero
SortedSet<Integer> 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<Integer> 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);
}

View file

@ -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;
}

View file

@ -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) {

View file

@ -5862,12 +5862,12 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
}
if (mid == lower) {
return Long.valueOf(upper);
return upper;
}
midOffset = tz.getOffset(mid);
if (midOffset != upperOffset) {
if (onUnitTime) {
return Long.valueOf(upper);
return upper;
}
return findPreviousZoneTransitionTime(tz, upperOffset, upper, mid);
}

View file

@ -41,7 +41,7 @@ public class CurrencyAmount extends Measure {
* @stable ICU 3.0
*/
public CurrencyAmount(double number, Currency currency) {
super(new Double(number), currency);
super(number, currency);
}
/**

View file

@ -31,7 +31,7 @@ public class TimeUnitAmount extends Measure {
* @stable ICU 4.0
*/
public TimeUnitAmount(double number, TimeUnit unit) {
super(new Double(number), unit);
super(number, unit);
}
/**

View file

@ -837,7 +837,7 @@ abstract public class TimeZone implements Serializable, Cloneable, Freezable<Tim
* @stable ICU 2.0
*/
public static String[] getAvailableIDs(int rawOffset) {
Set<String> ids = getAvailableIDs(SystemTimeZoneType.ANY, null, Integer.valueOf(rawOffset));
Set<String> ids = getAvailableIDs(SystemTimeZoneType.ANY, null, rawOffset);
return ids.toArray(new String[0]);
}

View file

@ -336,7 +336,7 @@ public final class VersionInfo implements Comparable<VersionInfo>
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);

View file

@ -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",

View file

@ -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);

View file

@ -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);

View file

@ -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);
}
/* ----------------------------------------------------------------- */

View file

@ -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<DATA.length; i+=2) {
cal.clear();

View file

@ -278,8 +278,8 @@ public class CalendarTestFmwk extends CoreTestFmwk {
h[0] = new HashMap();
h[1] = new HashMap();
}
h[0].put(new Integer(minActual), nub);
h[1].put(new Integer(maxActual), nub);
h[0].put(minActual, nub);
h[1].put(maxActual, nub);
if (minActual < minLow || minActual > 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=(");

View file

@ -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);

View file

@ -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)",
});
}

View file

@ -988,7 +988,7 @@ public class DateFormatRegressionTest extends CoreTestFmwk {
logln(what + "=" + s);
first = s.charAt(0);
if(first<kHindiZero || 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 || 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 || 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 || 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 || 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 || 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 || 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));
}
}
}

View file

@ -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);

View file

@ -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().

View file

@ -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(

View file

@ -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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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<Integer, String> 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);
}

View file

@ -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

View file

@ -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;
}

View file

@ -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.");

View file

@ -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);

View file

@ -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);
}

View file

@ -37,7 +37,7 @@ public class Mf2IcuTest extends CoreTestFmwk {
@Test
public void testStaticFormat() {
Map<String, Object> arguments = Args.of("planet", new Integer(7), "when", new Date(871068000000L), "what",
Map<String, Object> 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<String, Object> testArgs1 = Args.of("fileCount", new Integer(0), "diskName", "MyDisk");
Map<String, Object> testArgs2 = Args.of("fileCount", new Integer(1), "diskName", "MyDisk");
Map<String, Object> testArgs3 = Args.of("fileCount", new Integer(12), "diskName", "MyDisk");
Map<String, Object> testArgs1 = Args.of("fileCount", 0, "diskName", "MyDisk");
Map<String, Object> testArgs2 = Args.of("fileCount", 1, "diskName", "MyDisk");
Map<String, Object> testArgs3 = Args.of("fileCount", 12, "diskName", "MyDisk");
MessageFormatter form = MessageFormatter.builder()
.setPattern("{The disk \"{$diskName}\" contains {$fileCount} file(s).}")

View file

@ -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();
}

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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++;

View file

@ -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;

View file

@ -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<Long> inflectionPoints = new ArrayList<>();
private Set<String> 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

View file

@ -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();

View file

@ -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<DATA.length; i+=3) {
@ -1809,8 +1809,8 @@ public class TimeZoneTest extends CoreTestFmwk
*/
@Test
public void TestDisplayNamesMeta() {
final Integer TZSHORT = new Integer(TimeZone.SHORT);
final Integer TZLONG = new Integer(TimeZone.LONG);
final Integer TZSHORT = TimeZone.SHORT;
final Integer TZLONG = TimeZone.LONG;
final Object[][] zoneDisplayTestData = {
// zone id locale summer format expected display name

View file

@ -47,9 +47,8 @@ public class DisplayNameTest extends CoreTestFmwk {
for (int k = 0; k < codeToName.length; ++k) codeToName[k] = new HashMap();
}
static final Object[] zoneFormats = {new Integer(0), new Integer(1), new Integer(2),
new Integer(3), new Integer(4), new Integer(5), new Integer(6), new Integer(7)};
static final Object[] currencyFormats = {new Integer(Currency.SYMBOL_NAME), new Integer(Currency.LONG_NAME)};
static final Object[] zoneFormats = {0, 1, 2, 3, 4, 5, 6, 7};
static final Object[] currencyFormats = {Currency.SYMBOL_NAME, Currency.LONG_NAME};
static final Object[] NO_CONTEXT = {null};
static final Date JAN1;

View file

@ -1070,7 +1070,7 @@ public class LocaleMatcherTest extends CoreTestFmwk {
builder.setFavorSubtag(favor);
}
if (!test.threshold.isEmpty()) {
int threshold = Integer.valueOf(test.threshold);
int threshold = Integer.parseInt(test.threshold);
builder.internalSetThresholdDistance(threshold);
}
matcher = builder.build();

View file

@ -426,7 +426,7 @@ public class RegionTest extends CoreTestFmwk {
String inputID = data[0];
String expectedID = data[1];
Region.RegionType expectedType = Region.RegionType.valueOf(data[2]);
Region r = Region.getInstance(Integer.valueOf(inputID));
Region r = Region.getInstance(Integer.parseInt(inputID));
if ( !expectedID.equals(r.toString())) {
errln("Unexpected region ID for Region.getInstance(" + inputID + "); Expected: " + expectedID + " Got: " + r.toString());
}

View file

@ -22,22 +22,22 @@ import com.ibm.icu.text.UnicodeSet;
@RunWith(JUnit4.class)
public class TextTrieMapTest extends CoreTestFmwk {
private static final Integer SUN = new Integer(1);
private static final Integer MON = new Integer(2);
private static final Integer TUE = new Integer(3);
private static final Integer WED = new Integer(4);
private static final Integer THU = new Integer(5);
private static final Integer FRI = new Integer(6);
private static final Integer SAT = new Integer(7);
private static final Integer SUN = 1;
private static final Integer MON = 2;
private static final Integer TUE = 3;
private static final Integer WED = 4;
private static final Integer THU = 5;
private static final Integer FRI = 6;
private static final Integer SAT = 7;
private static final Integer SUP1 = new Integer(8);
private static final Integer SUP2 = new Integer(9);
private static final Integer SUP3 = new Integer(10);
private static final Integer SUP4 = new Integer(11);
private static final Integer SUP5 = new Integer(12);
private static final Integer SUP1 = 8;
private static final Integer SUP2 = 9;
private static final Integer SUP3 = 10;
private static final Integer SUP4 = 11;
private static final Integer SUP5 = 12;
private static final Integer FOO = new Integer(-1);
private static final Integer BAR = new Integer(-2);
private static final Integer FOO = -1;
private static final Integer BAR = -2;
private static final Object[][] TESTDATA = {
{"Sunday", SUN},

View file

@ -397,7 +397,7 @@ abstract public class TestFmwk extends AbstractTestLog {
if (s == null) {
return defVal;
}
return (maxVal == -1) ? Integer.valueOf(s) : Math.max(Integer.valueOf(s), maxVal);
return (maxVal == -1) ? Integer.parseInt(s) : Math.max(Integer.parseInt(s), maxVal);
}
public long getLongProperty(String key, long defVal) {
@ -405,7 +405,7 @@ abstract public class TestFmwk extends AbstractTestLog {
if (s == null) {
return defVal;
}
return Long.valueOf(s);
return Long.parseLong(s);
}
public int getInclusion() {

View file

@ -328,7 +328,7 @@ public class CalendarICU extends java.util.Calendar {
Map<String,Integer> res = new HashMap<String,Integer>();
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;

View file

@ -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),

View file

@ -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);

View file

@ -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) {

View file

@ -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;
}

View file

@ -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

View file

@ -25,7 +25,7 @@ public class UnicodeSetPerf extends PerfTest {
UnicodeSet testChars;
UnicodeSetIterator it;
UnicodeSet us;
HashSet hs;
HashSet<Integer> 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;
}
}

View file

@ -642,6 +642,43 @@
</build>
</profile>
<profile>
<!-- mvn test -ntp -DskipTests -DskipITs -P errorprone -->
<id>errorprone</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>UTF-8</encoding>
<!-- Use <compilerArg> to pass flags to errorprone. See https://errorprone.info/docs/flags -->
<showWarnings>true</showWarnings>
<compilerArgs>
<arg>-XDcompilePolicy=simple</arg>
<!--
-XepAllErrorsAsWarnings:
If we let errors be errors they fail and stop the build, so we don't get a full report.
So we force them all to be reported as warning.
The drawback is that there are not errors now, they get mixed with the real warnings.
-->
<arg>-Xplugin:ErrorProne -XepAllErrorsAsWarnings</arg>
</compilerArgs>
<annotationProcessorPaths>
<path>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.25.0</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View file

@ -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);

View file

@ -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);

View file

@ -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)

View file

@ -289,7 +289,7 @@ public class StatisticsTool implements NGramParser.NGramParserClient, NGramList.
writeStatistics(statKeys, false);
if (inputFile.getVisualOrder()) {
ArrayList reversed = new ArrayList(statKeys.size());
ArrayList<Integer> 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);

View file

@ -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();

View file

@ -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();
}
}

View file

@ -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();

View file

@ -167,7 +167,7 @@ class UnicodeSetCloseOver {
// and a string of length 3.
v.clear();
for (int j=0; j<a.length; ++j) {
v.add(new Integer(a[j].length()));
v.add(a[j].length());
}
Collections.sort(v);
buf.setLength(0);

View file

@ -92,7 +92,7 @@ public class ScanICU extends CapScan{
try {
ULocale available[] = ULocale.getAvailableLocales();
locs.setAttribute("total", new Integer(available.length).toString());
locs.setAttribute("total", Integer.toString(available.length));
String locinfo = "";
@ -130,7 +130,7 @@ public class ScanICU extends CapScan{
try {
ULocale available[] = Collator.getAvailableULocales();
Spinner sp = new Spinner(locs.getNodeName(),available.length);
locs.setAttribute("total", new Integer(available.length).toString());
locs.setAttribute("total", Integer.toString(available.length));
String locinfo = "";

View file

@ -42,7 +42,7 @@ public class ScanJava extends SimpleScan {
try {
Locale available[] = Collator.getAvailableLocales();
locs.setAttribute("total", new Integer(available.length).toString());
locs.setAttribute("total", Integer.toString(available.length));
System.err.println("Begin coll!");
String locinfo = "";
@ -78,7 +78,7 @@ public class ScanJava extends SimpleScan {
try {
Locale available[] = Locale.getAvailableLocales();
locs.setAttribute("total", new Integer(available.length).toString());
locs.setAttribute("total", Integer.toString(available.length));
String locinfo = "";

View file

@ -811,7 +811,7 @@ public class StableAPI {
// report.setParameter("leftStatus", leftStatus);
report.setParameter("leftVer", leftVer);
// report.setParameter("rightStatus", rightStatus);
report.setParameter("ourYear", new Integer(new java.util.GregorianCalendar().get(java.util.Calendar.YEAR)));
report.setParameter("ourYear", Integer.valueOf(new java.util.GregorianCalendar().get(java.util.Calendar.YEAR)));
report.setParameter("rightVer", rightVer);
report.setParameter("rightMilestone", rightMilestone);
report.setParameter("leftMilestone", leftMilestone);