mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-10 15:42:14 +00:00
ICU-22920 Fix raw type warnings in icu4j tests: charset, common_tests, translit
This commit is contained in:
parent
a7291c4e51
commit
ba012a74a1
38 changed files with 271 additions and 280 deletions
|
@ -802,8 +802,8 @@ public class TestCharset extends TestFmwk {
|
|||
int[] badposindices = new int[n];
|
||||
int[] malfindices = new int[n];
|
||||
int[] unmapindices = new int[n];
|
||||
ArrayList pass = new ArrayList();
|
||||
ArrayList exempt = new ArrayList();
|
||||
ArrayList<String> pass = new ArrayList<>();
|
||||
ArrayList<String> exempt = new ArrayList<>();
|
||||
|
||||
outer: for (int conv=0; conv<converters.length; conv++) {
|
||||
String converter = (String)converters[conv];
|
||||
|
@ -1622,9 +1622,9 @@ public class TestCharset extends TestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestAvailableCharsets() {
|
||||
SortedMap map = Charset.availableCharsets();
|
||||
Set keySet = map.keySet();
|
||||
Iterator iter = keySet.iterator();
|
||||
SortedMap<String, Charset> map = Charset.availableCharsets();
|
||||
Set<String> keySet = map.keySet();
|
||||
Iterator<String> iter = keySet.iterator();
|
||||
while(iter.hasNext()){
|
||||
logln("Charset name: "+iter.next().toString());
|
||||
}
|
||||
|
|
|
@ -110,8 +110,8 @@ public class TestConversion extends TestFmwk {
|
|||
String testName = td.getName().toString();
|
||||
|
||||
// Iterate through and get each of the test case to process
|
||||
for (Iterator iter = td.getDataIterator(); iter.hasNext();) {
|
||||
DataMap testcase = (DataMap) iter.next();
|
||||
for (Iterator<DataMap> iter = td.getDataIterator(); iter.hasNext();) {
|
||||
DataMap testcase = iter.next();
|
||||
|
||||
if (testName.equalsIgnoreCase("toUnicode")) {
|
||||
TestToUnicode(testcase, testToUnicode);
|
||||
|
|
|
@ -127,7 +127,7 @@ public class TestSelection extends TestFmwk {
|
|||
/* This test is to provide better code coverage for CharsetSelector */
|
||||
@Test
|
||||
public void TestCharsetSelectorCodeCoverage() {
|
||||
List emptyList = new ArrayList();
|
||||
List<String> emptyList = new ArrayList<>();
|
||||
UnicodeSet nonEmptySet = new UnicodeSet();
|
||||
|
||||
nonEmptySet.add(0x0001, 0x0FFF);
|
||||
|
|
|
@ -52,7 +52,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
private static final String ARROW = "\u2192";
|
||||
private static final boolean DEBUG = ICUDebug.enabled("alphabeticindex");
|
||||
|
||||
public static Set<String> KEY_LOCALES = new LinkedHashSet(Arrays.asList(
|
||||
public static Set<String> KEY_LOCALES = new LinkedHashSet<>(Arrays.asList(
|
||||
"en", "es", "de", "fr", "ja", "it", "tr", "pt", "zh", "nl",
|
||||
"pl", "ar", "ru", "zh_Hant", "ko", "th", "sv", "fi", "da",
|
||||
"he", "nb", "el", "hr", "bg", "sk", "lt", "vi", "lv", "sr",
|
||||
|
@ -224,7 +224,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
final String probe = test[1];
|
||||
final String expectedLabel = test[2];
|
||||
alphabeticIndex.addRecord(probe, 1);
|
||||
List labels = alphabeticIndex.getBucketLabels();
|
||||
List<String> labels = alphabeticIndex.getBucketLabels();
|
||||
logln(labels.toString());
|
||||
Bucket<Integer> bucket = find(alphabeticIndex, probe);
|
||||
assertEquals("locale " + test[0] + " name=" + probe + " in bucket",
|
||||
|
@ -246,7 +246,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
@Test
|
||||
public void TestFirstCharacters() {
|
||||
|
||||
AlphabeticIndex alphabeticIndex = new AlphabeticIndex(Locale.ENGLISH);
|
||||
AlphabeticIndex<String> alphabeticIndex = new AlphabeticIndex<>(Locale.ENGLISH);
|
||||
RuleBasedCollator collator = alphabeticIndex.getCollator();
|
||||
collator.setStrength(Collator.IDENTICAL);
|
||||
Collection<String> firsts = alphabeticIndex.getFirstCharactersInScripts();
|
||||
|
@ -316,7 +316,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
locales.addAll(Arrays.asList(ULocale.getAvailableLocales()));
|
||||
for (ULocale locale : locales) {
|
||||
try {
|
||||
AlphabeticIndex<String> alphabeticIndex = new AlphabeticIndex(locale);
|
||||
AlphabeticIndex<String> alphabeticIndex = new AlphabeticIndex<>(locale);
|
||||
alphabeticIndex.addRecord("hi", "HI");
|
||||
for (Bucket<String> bucket : alphabeticIndex) {
|
||||
@SuppressWarnings("unused")
|
||||
|
@ -331,7 +331,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestSetGetSpecialLabels() {
|
||||
AlphabeticIndex index = new AlphabeticIndex(Locale.GERMAN).addLabels(new Locale("ru"));
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<String>(Locale.GERMAN).addLabels(new Locale("ru"));
|
||||
index.setUnderflowLabel("__");
|
||||
index.setInflowLabel("--");
|
||||
index.setOverflowLabel("^^");
|
||||
|
@ -339,7 +339,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
assertEquals("inflow label", "--", index.getInflowLabel());
|
||||
assertEquals("overflow label", "^^", index.getOverflowLabel());
|
||||
|
||||
ImmutableIndex ii = index.buildImmutableIndex();
|
||||
ImmutableIndex<String> ii = index.buildImmutableIndex();
|
||||
assertEquals("0 -> underflow", "__", ii.getBucket(ii.getBucketIndex("0")).getLabel());
|
||||
assertEquals("Ω -> inflow", "--", ii.getBucket(ii.getBucketIndex("Ω")).getLabel());
|
||||
assertEquals("字 -> overflow", "^^", ii.getBucket(ii.getBucketIndex("字")).getLabel());
|
||||
|
@ -357,7 +357,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
};
|
||||
for (Object[] test : tests) {
|
||||
int expected = (Integer) test[0];
|
||||
AlphabeticIndex<Double> alphabeticIndex = new AlphabeticIndex((ULocale)test[1]);
|
||||
AlphabeticIndex<Double> alphabeticIndex = new AlphabeticIndex<>((ULocale)test[1]);
|
||||
for (int i = 2; i < test.length; ++i) {
|
||||
if (test[i] instanceof ULocale) {
|
||||
alphabeticIndex.addLabels((ULocale)test[i]);
|
||||
|
@ -365,7 +365,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
alphabeticIndex.addLabels((UnicodeSet)test[i]);
|
||||
}
|
||||
}
|
||||
Counter<AlphabeticIndex.Bucket.LabelType> counter = new Counter();
|
||||
Counter<LabelType> counter = new Counter<>();
|
||||
for (Bucket<Double> bucket : alphabeticIndex) {
|
||||
LabelType labelType = bucket.getLabelType();
|
||||
counter.add(labelType, 1);
|
||||
|
@ -375,7 +375,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
assertEquals(LabelType.INFLOW + "\t" + printList, expected, counter.get(LabelType.INFLOW));
|
||||
if (expected != counter.get(LabelType.INFLOW)) {
|
||||
// for debugging
|
||||
AlphabeticIndex<Double> indexCharacters2 = new AlphabeticIndex((ULocale)test[1]);
|
||||
AlphabeticIndex<Double> indexCharacters2 = new AlphabeticIndex<>((ULocale)test[1]);
|
||||
for (int i = 2; i < test.length; ++i) {
|
||||
if (test[i] instanceof ULocale) {
|
||||
indexCharacters2.addLabels((ULocale)test[i]);
|
||||
|
@ -398,7 +398,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
// Create a simple index where the values for the strings are Integers, and add the strings
|
||||
AlphabeticIndex<Integer> index = new AlphabeticIndex<Integer>(desiredLocale).addLabels(additionalLocale);
|
||||
int counter = 0;
|
||||
Counter<String> itemCount = new Counter();
|
||||
Counter<String> itemCount = new Counter<>();
|
||||
for (String item : test) {
|
||||
index.addRecord(item, counter++);
|
||||
itemCount.add(item, 1);
|
||||
|
@ -524,7 +524,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
|
||||
private Counter<String> getKeys(AlphabeticIndex.Bucket<Integer> entry) {
|
||||
Counter<String> keys = new Counter<String>();
|
||||
for (AlphabeticIndex.Record x : entry) {
|
||||
for (AlphabeticIndex.Record<Integer> x : entry) {
|
||||
String key = x.getName().toString();
|
||||
keys.add(key, 1);
|
||||
}
|
||||
|
@ -536,7 +536,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
for (String[] localeAndIndexCharacters : localeAndIndexCharactersLists) {
|
||||
ULocale locale = new ULocale(localeAndIndexCharacters[0]);
|
||||
String expectedIndexCharacters = "\u2026:" + localeAndIndexCharacters[1] + ":\u2026";
|
||||
Collection<String> alphabeticIndex = new AlphabeticIndex(locale).getBucketLabels();
|
||||
Collection<String> alphabeticIndex = new AlphabeticIndex<>(locale).getBucketLabels();
|
||||
|
||||
// Join the elements of the list to a string with delimiter ":"
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -561,7 +561,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
ULocale[] list = ULocale.getAvailableLocales();
|
||||
// get keywords combinations
|
||||
// don't bother with multiple combinations at this point
|
||||
List keywords = new ArrayList();
|
||||
List<String> keywords = new ArrayList<>();
|
||||
keywords.add("");
|
||||
|
||||
String[] collationValues = Collator.getKeywordValues("collation");
|
||||
|
@ -570,8 +570,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
}
|
||||
|
||||
for (int i = 0; i < list.length; ++i) {
|
||||
for (Iterator it = keywords.iterator(); it.hasNext();) {
|
||||
String collationValue = (String) it.next();
|
||||
for (String collationValue : keywords) {
|
||||
String localeString = list[i].toString();
|
||||
if (!KEY_LOCALES.contains(localeString)) continue; // TODO change in exhaustive
|
||||
ULocale locale = new ULocale(localeString + collationValue);
|
||||
|
@ -584,13 +583,13 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
continue;
|
||||
}
|
||||
boolean isUnihan = collationValue.contains("unihan");
|
||||
AlphabeticIndex alphabeticIndex = new AlphabeticIndex(locale);
|
||||
AlphabeticIndex<String> alphabeticIndex = new AlphabeticIndex<>(locale);
|
||||
if (isUnihan) {
|
||||
// Unihan tailorings have a label per radical, and there are at least 214,
|
||||
// if not more when simplified radicals are distinguished.
|
||||
alphabeticIndex.setMaxLabelCount(500);
|
||||
}
|
||||
final Collection mainChars = alphabeticIndex.getBucketLabels();
|
||||
final Collection<String> mainChars = alphabeticIndex.getBucketLabels();
|
||||
String mainCharString = mainChars.toString();
|
||||
if (mainCharString.length() > 500) {
|
||||
mainCharString = mainCharString.substring(0,500) + "...";
|
||||
|
@ -687,7 +686,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
@Test
|
||||
public void TestFirstScriptCharacters() {
|
||||
Collection<String> firstCharacters =
|
||||
new AlphabeticIndex(ULocale.ENGLISH).getFirstCharactersInScripts();
|
||||
new AlphabeticIndex<>(ULocale.ENGLISH).getFirstCharactersInScripts();
|
||||
Collection<String> expectedFirstCharacters = firstStringsInScript((RuleBasedCollator) Collator.getInstance(ULocale.ROOT));
|
||||
Collection<String> diff = new TreeSet<String>(firstCharacters);
|
||||
diff.removeAll(expectedFirstCharacters);
|
||||
|
@ -923,7 +922,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
public void TestHaniFirst() {
|
||||
RuleBasedCollator coll = (RuleBasedCollator) Collator.getInstance(ULocale.ROOT);
|
||||
coll.setReorderCodes(UScript.HAN);
|
||||
AlphabeticIndex index = new AlphabeticIndex(coll);
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(coll);
|
||||
assertEquals("getBucketCount()", 1, index.getBucketCount()); // ... (underflow only)
|
||||
index.addLabels(Locale.ENGLISH);
|
||||
assertEquals("getBucketCount()", 28, index.getBucketCount()); // ... A-Z ...
|
||||
|
@ -947,7 +946,7 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
public void TestPinyinFirst() {
|
||||
RuleBasedCollator coll = (RuleBasedCollator) Collator.getInstance(ULocale.CHINESE);
|
||||
coll.setReorderCodes(UScript.HAN);
|
||||
AlphabeticIndex index = new AlphabeticIndex(coll);
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(coll);
|
||||
assertEquals("getBucketCount()", 28, index.getBucketCount()); // ... A-Z ...
|
||||
index.addLabels(Locale.CHINESE);
|
||||
assertEquals("getBucketCount()", 28, index.getBucketCount()); // ... A-Z ...
|
||||
|
@ -969,10 +968,10 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
*/
|
||||
@Test
|
||||
public void TestSchSt() {
|
||||
AlphabeticIndex index = new AlphabeticIndex(ULocale.GERMAN);
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(ULocale.GERMAN);
|
||||
index.addLabels(new UnicodeSet("[Æ{Sch*}{St*}]"));
|
||||
// ... A Æ B-R S Sch St T-Z ...
|
||||
ImmutableIndex immIndex = index.buildImmutableIndex();
|
||||
ImmutableIndex<String> immIndex = index.buildImmutableIndex();
|
||||
assertEquals("getBucketCount()", 31, index.getBucketCount());
|
||||
assertEquals("immutable getBucketCount()", 31, immIndex.getBucketCount());
|
||||
String[][] testCases = new String[][] {
|
||||
|
@ -1028,8 +1027,8 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
*/
|
||||
@Test
|
||||
public void TestChineseZhuyin() {
|
||||
AlphabeticIndex index = new AlphabeticIndex(ULocale.forLanguageTag("zh-u-co-zhuyin"));
|
||||
ImmutableIndex immIndex = index.buildImmutableIndex();
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(ULocale.forLanguageTag("zh-u-co-zhuyin"));
|
||||
ImmutableIndex<String> immIndex = index.buildImmutableIndex();
|
||||
assertEquals("getBucketCount()", 38, immIndex.getBucketCount()); // ... ㄅ ㄆ ㄇ ㄈ ㄉ -- ㄩ ...
|
||||
assertEquals("label 1", "ㄅ", immIndex.getBucket(1).getLabel());
|
||||
assertEquals("label 2", "ㄆ", immIndex.getBucket(2).getLabel());
|
||||
|
@ -1040,8 +1039,8 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestJapaneseKanji() {
|
||||
AlphabeticIndex index = new AlphabeticIndex(ULocale.JAPANESE);
|
||||
AlphabeticIndex.ImmutableIndex immIndex = index.buildImmutableIndex();
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(ULocale.JAPANESE);
|
||||
AlphabeticIndex.ImmutableIndex<String> immIndex = index.buildImmutableIndex();
|
||||
// There are no index characters for Kanji in the Japanese standard collator.
|
||||
// They should all go into the overflow bucket.
|
||||
final int[] kanji = { 0x4E9C, 0x95C7, 0x4E00, 0x58F1 };
|
||||
|
@ -1061,17 +1060,17 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
// The AlphabeticIndex constructor used to throw an exception
|
||||
// because it cloned the collator (which preserves frozenness)
|
||||
// and set the clone's strength to PRIMARY.
|
||||
AlphabeticIndex index = new AlphabeticIndex(coll);
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(coll);
|
||||
assertEquals("same strength as input Collator",
|
||||
Collator.IDENTICAL, index.getCollator().getStrength());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestChineseUnihan() {
|
||||
AlphabeticIndex index = new AlphabeticIndex(new ULocale("zh-u-co-unihan"));
|
||||
AlphabeticIndex<String> index = new AlphabeticIndex<>(new ULocale("zh-u-co-unihan"));
|
||||
index.setMaxLabelCount(500); // ICU 54 default is 99.
|
||||
assertEquals("getMaxLabelCount()", 500, index.getMaxLabelCount()); // code coverage
|
||||
AlphabeticIndex.ImmutableIndex immIndex = index.buildImmutableIndex();
|
||||
AlphabeticIndex.ImmutableIndex<String> immIndex = index.buildImmutableIndex();
|
||||
int bucketCount = immIndex.getBucketCount();
|
||||
if(bucketCount < 216) {
|
||||
// There should be at least an underflow and overflow label,
|
||||
|
@ -1095,8 +1094,8 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
|
||||
@Test
|
||||
public void testAddLabels_Locale() {
|
||||
AlphabeticIndex<?> ulocaleIndex = new AlphabeticIndex<String>(ULocale.CANADA);
|
||||
AlphabeticIndex<?> localeIndex = new AlphabeticIndex<String>(Locale.CANADA);
|
||||
AlphabeticIndex<?> ulocaleIndex = new AlphabeticIndex<>(ULocale.CANADA);
|
||||
AlphabeticIndex<?> localeIndex = new AlphabeticIndex<>(Locale.CANADA);
|
||||
ulocaleIndex.addLabels(ULocale.SIMPLIFIED_CHINESE);
|
||||
localeIndex.addLabels(Locale.SIMPLIFIED_CHINESE);
|
||||
assertEquals("getBucketLables() results of ulocaleIndex and localeIndex differ",
|
||||
|
@ -1171,12 +1170,12 @@ public class AlphabeticIndexTest extends TestFmwk {
|
|||
}
|
||||
|
||||
private void checkHasBuckets(Locale locale, int script) {
|
||||
AlphabeticIndex.ImmutableIndex index =
|
||||
AlphabeticIndex.ImmutableIndex<String> index =
|
||||
new AlphabeticIndex<String>(locale).buildImmutableIndex();
|
||||
String loc = locale.toString();
|
||||
assertTrue(loc + " at least 3 buckets", index.getBucketCount() >= 3);
|
||||
AlphabeticIndex.Bucket bucket = index.getBucket(1);
|
||||
assertEquals(loc + " real bucket", AlphabeticIndex.Bucket.LabelType.NORMAL,
|
||||
AlphabeticIndex.Bucket<String> bucket = index.getBucket(1);
|
||||
assertEquals(loc + " real bucket", LabelType.NORMAL,
|
||||
bucket.getLabelType());
|
||||
assertEquals(loc + " expected script", script,
|
||||
UScript.getScript(bucket.getLabel().codePointAt(0)));
|
||||
|
|
|
@ -2256,7 +2256,7 @@ public class CollationMiscTest extends TestFmwk {
|
|||
}
|
||||
}
|
||||
|
||||
Set foundValues = new TreeSet(Arrays.asList(values));
|
||||
Set<String> foundValues = new TreeSet<>(Arrays.asList(values));
|
||||
|
||||
for (int i = 0; i < locales.length; ++i) {
|
||||
for (int j = 0; j < values.length; ++j) {
|
||||
|
|
|
@ -1072,7 +1072,7 @@ public class CollationRegressionTest extends TestFmwk {
|
|||
String text = "T\u00f6ne"; // o-umlaut
|
||||
|
||||
CollationElementIterator iter = coll.getCollationElementIterator(text);
|
||||
List elements = new ArrayList();
|
||||
List<Integer> elements = new ArrayList<>();
|
||||
int elem;
|
||||
|
||||
// Iterate forward and collect all of the elements into a Vector
|
||||
|
@ -1084,7 +1084,7 @@ public class CollationRegressionTest extends TestFmwk {
|
|||
iter.reset();
|
||||
int index = elements.size() - 1;
|
||||
while ((elem = iter.previous()) != CollationElementIterator.NULLORDER) {
|
||||
int expect = ((Integer)elements.get(index)).intValue();
|
||||
int expect = (elements.get(index)).intValue();
|
||||
|
||||
if (elem != expect) {
|
||||
errln("Mismatch at index " + index
|
||||
|
|
|
@ -131,9 +131,9 @@ public class CollationServiceTest extends TestFmwk {
|
|||
class CollatorInfo {
|
||||
ULocale locale;
|
||||
Collator collator;
|
||||
Map displayNames; // locale -> string
|
||||
Map<ULocale, String> displayNames; // locale -> string
|
||||
|
||||
CollatorInfo(ULocale locale, Collator collator, Map displayNames) {
|
||||
CollatorInfo(ULocale locale, Collator collator, Map<ULocale, String> displayNames) {
|
||||
this.locale = locale;
|
||||
this.collator = collator;
|
||||
this.displayNames = displayNames;
|
||||
|
@ -142,7 +142,7 @@ public class CollationServiceTest extends TestFmwk {
|
|||
String getDisplayName(ULocale displayLocale) {
|
||||
String name = null;
|
||||
if (displayNames != null) {
|
||||
name = (String)displayNames.get(displayLocale);
|
||||
name = displayNames.get(displayLocale);
|
||||
}
|
||||
if (name == null) {
|
||||
name = locale.getDisplayName(displayLocale);
|
||||
|
@ -152,11 +152,11 @@ public class CollationServiceTest extends TestFmwk {
|
|||
}
|
||||
|
||||
class TestFactory extends CollatorFactory {
|
||||
private Map map;
|
||||
private Set ids;
|
||||
private Map<ULocale, CollatorInfo> map;
|
||||
private Set<String> ids;
|
||||
|
||||
TestFactory(CollatorInfo[] info) {
|
||||
map = new HashMap();
|
||||
map = new HashMap<>();
|
||||
for (int i = 0; i < info.length; ++i) {
|
||||
CollatorInfo ci = info[i];
|
||||
map.put(ci.locale, ci);
|
||||
|
@ -165,7 +165,7 @@ public class CollationServiceTest extends TestFmwk {
|
|||
|
||||
@Override
|
||||
public Collator createCollator(ULocale loc) {
|
||||
CollatorInfo ci = (CollatorInfo)map.get(loc);
|
||||
CollatorInfo ci = map.get(loc);
|
||||
if (ci != null) {
|
||||
return ci.collator;
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ public class CollationServiceTest extends TestFmwk {
|
|||
|
||||
@Override
|
||||
public String getDisplayName(ULocale objectLocale, ULocale displayLocale) {
|
||||
CollatorInfo ci = (CollatorInfo)map.get(objectLocale);
|
||||
CollatorInfo ci = map.get(objectLocale);
|
||||
if (ci != null) {
|
||||
return ci.getDisplayName(displayLocale);
|
||||
}
|
||||
|
@ -182,12 +182,12 @@ public class CollationServiceTest extends TestFmwk {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Set getSupportedLocaleIDs() {
|
||||
public Set<String> getSupportedLocaleIDs() {
|
||||
if (ids == null) {
|
||||
HashSet set = new HashSet();
|
||||
Iterator iter = map.keySet().iterator();
|
||||
HashSet<String> set = new HashSet<>();
|
||||
Iterator<ULocale> iter = map.keySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ULocale locale = (ULocale)iter.next();
|
||||
ULocale locale = iter.next();
|
||||
String id = locale.toString();
|
||||
set.add(id);
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ public class CollationServiceTest extends TestFmwk {
|
|||
// use CollatorFactory getDisplayName(ULocale, ULocale) for coverage
|
||||
|
||||
@Override
|
||||
public Set getSupportedLocaleIDs() {
|
||||
public Set<String> getSupportedLocaleIDs() {
|
||||
return delegate.getSupportedLocaleIDs();
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ public class CollationServiceTest extends TestFmwk {
|
|||
ULocale fu_FU = new ULocale("fu_FU");
|
||||
ULocale fu_FU_FOO = new ULocale("fu_FU_FOO");
|
||||
|
||||
Map fuFUNames = new HashMap();
|
||||
Map<ULocale, String> fuFUNames = new HashMap<>();
|
||||
fuFUNames.put(fu_FU, "ze leetle bunny Fu-Fu");
|
||||
fuFUNames.put(fu_FU_FOO, "zee leetel bunny Foo-Foo");
|
||||
fuFUNames.put(ULocale.US, "little bunny Foo Foo");
|
||||
|
|
|
@ -166,7 +166,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
|
|||
// setLocales(ULocale[])
|
||||
logln("Call setLocales(List) after frozen");
|
||||
bSet = true;
|
||||
ArrayList list = new ArrayList(1);
|
||||
ArrayList<ULocale> list = new ArrayList<>(1);
|
||||
list.add(new ULocale("fr_FR"));
|
||||
try {
|
||||
gp.setLocales(list);
|
||||
|
@ -274,7 +274,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
|
|||
// setLocales(List)
|
||||
for (int i = 0; i < INPUT_LOCALEIDS.length; i++) {
|
||||
String[] localeStrings = INPUT_LOCALEIDS[i];
|
||||
ArrayList locales = new ArrayList();
|
||||
ArrayList<ULocale> locales = new ArrayList<>();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int j = 0; j < localeStrings.length; j++) {
|
||||
locales.add(new ULocale(localeStrings[j]));
|
||||
|
@ -288,7 +288,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
|
|||
gp.reset();
|
||||
gp.setLocales(locales);
|
||||
|
||||
List resultLocales = gp.getLocales();
|
||||
List<ULocale> resultLocales = gp.getLocales();
|
||||
if (resultLocales.size() != RESULTS_LOCALEIDS[i].length) {
|
||||
errln("FAIL: Number of locales mismatch - GP:" + resultLocales.size()
|
||||
+ " Expected:" + RESULTS_LOCALEIDS[i].length);
|
||||
|
@ -322,7 +322,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
|
|||
gp.reset();
|
||||
gp.setLocales(localeArray);
|
||||
|
||||
List resultLocales = gp.getLocales();
|
||||
List<ULocale> resultLocales = gp.getLocales();
|
||||
if (resultLocales.size() != RESULTS_LOCALEIDS[i].length) {
|
||||
errln("FAIL: Number of locales mismatch - GP:" + resultLocales.size()
|
||||
+ " Expected:" + RESULTS_LOCALEIDS[i].length);
|
||||
|
@ -1004,11 +1004,11 @@ public class GlobalizationPreferencesTest extends TestFmwk {
|
|||
ULocale loc_peo = new ULocale("peo");
|
||||
|
||||
// Locale list - fr_FR_Paris
|
||||
ArrayList locales1 = new ArrayList(1);
|
||||
ArrayList<ULocale> locales1 = new ArrayList<>(1);
|
||||
locales1.add(loc_fr_FR_Paris);
|
||||
|
||||
// Locale list - ain, fr_FR_Paris
|
||||
ArrayList locales2 = new ArrayList(2);
|
||||
ArrayList<ULocale> locales2 = new ArrayList<>(2);
|
||||
locales2.add(loc_peo);
|
||||
locales2.add(loc_fr_FR_Paris);
|
||||
|
||||
|
@ -1200,7 +1200,7 @@ public class GlobalizationPreferencesTest extends TestFmwk {
|
|||
}
|
||||
|
||||
// Set locale - fr, fr_CA, fr_FR
|
||||
ArrayList lcls = new ArrayList(3);
|
||||
ArrayList<ULocale> lcls = new ArrayList<>(3);
|
||||
lcls.add(new ULocale("fr"));
|
||||
lcls.add(new ULocale("fr_CA"));
|
||||
lcls.add(new ULocale("fr_FR"));
|
||||
|
|
|
@ -39,7 +39,7 @@ public class LocaleAliasCollationTest extends com.ibm.icu.dev.test.TestFmwk {
|
|||
|
||||
private static final int _LOCALE_NUMBER = _LOCALES.length;
|
||||
private ULocale[] available = null;
|
||||
private HashMap availableMap = new HashMap();
|
||||
private HashMap<String, String> availableMap = new HashMap<>();
|
||||
private static final ULocale _DEFAULT_LOCALE = ULocale.US;
|
||||
|
||||
public LocaleAliasCollationTest() {
|
||||
|
|
|
@ -150,9 +150,9 @@ public class ULocaleCollationTest extends TestFmwk {
|
|||
*/
|
||||
void checkObject(String requestedLocale, Object obj,
|
||||
String expReqValid, String expValidActual) {
|
||||
Class[] getLocaleParams = new Class[] { ULocale.Type.class };
|
||||
Class<?>[] getLocaleParams = new Class[] { ULocale.Type.class };
|
||||
try {
|
||||
Class cls = obj.getClass();
|
||||
Class<?> cls = obj.getClass();
|
||||
Method getLocale = cls.getMethod("getLocale", getLocaleParams);
|
||||
ULocale valid = (ULocale) getLocale.invoke(obj, new Object[] {
|
||||
ULocale.VALID_LOCALE });
|
||||
|
|
|
@ -135,9 +135,9 @@ public class DataDrivenCalendarTest extends CoreTestFmwk {
|
|||
// DateFormat fmt = new SimpleDateFormat("EEE MMM dd yyyy / YYYY'-W'ww-ee");
|
||||
// Start the processing
|
||||
int n = 0;
|
||||
for (Iterator iter = testData.getDataIterator(); iter.hasNext();) {
|
||||
for (Iterator<DataMap> iter = testData.getDataIterator(); iter.hasNext();) {
|
||||
++n;
|
||||
DataMap currentCase = (DataMap) iter.next();
|
||||
DataMap currentCase = iter.next();
|
||||
|
||||
String caseString = "["+testData.getName()+"#"+n+" "+"]";
|
||||
String locale = testSetting = currentCase.getString("locale");
|
||||
|
@ -180,7 +180,7 @@ public class DataDrivenCalendarTest extends CoreTestFmwk {
|
|||
|
||||
boolean useDate = false;
|
||||
|
||||
for (Iterator iter = testData.getDataIterator(); iter.hasNext();) {
|
||||
for (Iterator<DataMap> iter = testData.getDataIterator(); iter.hasNext();) {
|
||||
++n;
|
||||
DataMap currentCase = (DataMap) iter.next();
|
||||
|
||||
|
|
|
@ -86,10 +86,10 @@ public class DataDrivenFormatTest extends CoreTestFmwk {
|
|||
DateFormat basicFmt = new SimpleDateFormat("EEE MMM dd yyyy / YYYY'-W'ww-ee");
|
||||
|
||||
int n = 0;
|
||||
for (Iterator iter = testData.getDataIterator(); iter.hasNext();) {
|
||||
for (Iterator<DataMap> iter = testData.getDataIterator(); iter.hasNext();) {
|
||||
++n;
|
||||
long now = System.currentTimeMillis();
|
||||
DataMap currentCase = (DataMap) iter.next();
|
||||
DataMap currentCase = iter.next();
|
||||
String caseString = "["+testData.getName()+"#"+n+(fmt?"format":"parse")+"]";
|
||||
|
||||
String locale = currentCase.getString("locale");
|
||||
|
|
|
@ -3533,7 +3533,7 @@ public class DateFormatTest extends CoreTestFmwk {
|
|||
int patidx = 0;
|
||||
|
||||
while (true) {
|
||||
Map map = acit.getAttributes();
|
||||
Map<AttributedCharacterIterator.Attribute, Object> map = acit.getAttributes();
|
||||
int limit = acit.getRunLimit();
|
||||
if (map.isEmpty()) {
|
||||
// Must be pattern literal - '~'
|
||||
|
@ -3544,10 +3544,10 @@ public class DateFormatTest extends CoreTestFmwk {
|
|||
acit.next();
|
||||
}
|
||||
} else {
|
||||
Set keySet = map.keySet();
|
||||
Set<AttributedCharacterIterator.Attribute> keySet = map.keySet();
|
||||
if (keySet.size() == 1) {
|
||||
// Check the attribute
|
||||
Iterator keyIterator = keySet.iterator();
|
||||
Iterator<AttributedCharacterIterator.Attribute> keyIterator = keySet.iterator();
|
||||
DateFormat.Field attr = (DateFormat.Field)keyIterator.next();
|
||||
if (!DATEFORMAT_FIELDS[patidx].equals(attr)) {
|
||||
errln("FAIL: The attribute at " + acit.getIndex() + " in patterns[" + i + "" +
|
||||
|
@ -3577,7 +3577,7 @@ public class DateFormatTest extends CoreTestFmwk {
|
|||
|
||||
ChineseDateFormat cdf = new ChineseDateFormat("y'x'G-Ml-d", ULocale.US);
|
||||
acit = cdf.formatToCharacterIterator(nonLeapMonthDate);
|
||||
Set keys = acit.getAllAttributeKeys();
|
||||
Set<AttributedCharacterIterator.Attribute> keys = acit.getAllAttributeKeys();
|
||||
if (keys.contains(ChineseDateFormat.Field.IS_LEAP_MONTH)) {
|
||||
errln("FAIL: separate IS_LEAP_MONTH field should not be present for a Chinese calendar non-leap date"
|
||||
+ cdf.format(nonLeapMonthDate));
|
||||
|
@ -4744,7 +4744,7 @@ public class DateFormatTest extends CoreTestFmwk {
|
|||
@Test
|
||||
public void TestDotAndAtLeniency() {
|
||||
for (ULocale locale : Arrays.asList(ULocale.ENGLISH, ULocale.FRENCH)) {
|
||||
List<Object[]> tests = new ArrayList();
|
||||
List<Object[]> tests = new ArrayList<>();
|
||||
|
||||
for (int dateStyle = DateFormat.FULL; dateStyle <= DateFormat.SHORT; ++dateStyle) {
|
||||
DateFormat dateFormat = DateFormat.getDateInstance(dateStyle, locale);
|
||||
|
|
|
@ -459,7 +459,7 @@ public class IntlTestDecimalFormatAPIC extends CoreTestFmwk {
|
|||
/**
|
||||
* compares two vectors regardless of the order of their elements
|
||||
*/
|
||||
private static boolean compare(List vector1, List vector2) {
|
||||
private static boolean compare(List<FieldContainer> vector1, List<FieldContainer> vector2) {
|
||||
return vector1.size() == vector2.size() && vector1.containsAll(vector2);
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ public class IntlTestDecimalFormatAPIC extends CoreTestFmwk {
|
|||
int start = iterator.getRunStart();
|
||||
int end = iterator.getRunLimit();
|
||||
|
||||
Iterator it = iterator.getAttributes().keySet().iterator();
|
||||
Iterator<AttributedCharacterIterator.Attribute> it = iterator.getAttributes().keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute) it
|
||||
.next();
|
||||
|
|
|
@ -3181,7 +3181,7 @@ public class NumberFormatTest extends CoreTestFmwk {
|
|||
double expected = 12345;
|
||||
DecimalFormatSymbols sym = new DecimalFormatSymbols(Locale.US);
|
||||
DecimalFormat fmt = new DecimalFormat("#.#", sym);
|
||||
ArrayList errors = new ArrayList();
|
||||
ArrayList<String> errors = new ArrayList<>();
|
||||
|
||||
ParseThreadJB5358[] threads = new ParseThreadJB5358[numThreads];
|
||||
for (int i = 0; i < numThreads; i++) {
|
||||
|
@ -3198,7 +3198,7 @@ public class NumberFormatTest extends CoreTestFmwk {
|
|||
if (errors.size() != 0) {
|
||||
StringBuffer errBuf = new StringBuffer();
|
||||
for (int i = 0; i < errors.size(); i++) {
|
||||
errBuf.append((String)errors.get(i));
|
||||
errBuf.append(errors.get(i));
|
||||
errBuf.append("\n");
|
||||
}
|
||||
errln("FAIL: " + errBuf);
|
||||
|
@ -3209,9 +3209,9 @@ public class NumberFormatTest extends CoreTestFmwk {
|
|||
private final DecimalFormat decfmt;
|
||||
private final String numstr;
|
||||
private final double expect;
|
||||
private final ArrayList errors;
|
||||
private final ArrayList<String> errors;
|
||||
|
||||
public ParseThreadJB5358(DecimalFormat decfmt, String numstr, double expect, ArrayList errors) {
|
||||
public ParseThreadJB5358(DecimalFormat decfmt, String numstr, double expect, ArrayList<String> errors) {
|
||||
this.decfmt = decfmt;
|
||||
this.numstr = numstr;
|
||||
this.expect = expect;
|
||||
|
@ -4793,7 +4793,7 @@ public class NumberFormatTest extends CoreTestFmwk {
|
|||
while (iterator.getIndex() != iterator.getEndIndex()) {
|
||||
int start = iterator.getRunStart();
|
||||
int end = iterator.getRunLimit();
|
||||
Iterator it = iterator.getAttributes().keySet().iterator();
|
||||
Iterator<AttributedCharacterIterator.Attribute> it = iterator.getAttributes().keySet().iterator();
|
||||
AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute) it.next();
|
||||
// For positions with both INTEGER and GROUPING attributes, we want the GROUPING attribute.
|
||||
if (it.hasNext() && attribute.equals(NumberFormat.Field.INTEGER)) {
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.LinkedHashSet;
|
|||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
@ -168,8 +167,8 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
{ "a:n in 3 .. 10 , 13 .. 19 ,", ParseException.class }, };
|
||||
for (Object[] shouldFailTest : shouldFail) {
|
||||
String rules = (String) shouldFailTest[0];
|
||||
Class exception = shouldFailTest.length < 2 ? null : (Class) shouldFailTest[1];
|
||||
Class actualException = null;
|
||||
Class<?> exception = shouldFailTest.length < 2 ? null : (Class<?>) shouldFailTest[1];
|
||||
Class<?> actualException = null;
|
||||
try {
|
||||
PluralRules.parseDescription(rules);
|
||||
} catch (Exception e) {
|
||||
|
@ -279,8 +278,8 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
|
||||
// Collect actual (oldSamples) and expected (expectedSamplesList) into the
|
||||
// same concrete collection for comparison purposes.
|
||||
ArrayList<DecimalQuantity> oldSamplesList = new ArrayList(oldSamples);
|
||||
ArrayList<DecimalQuantity> expectedSamplesList = new ArrayList(Arrays.asList(expected));
|
||||
ArrayList<DecimalQuantity> oldSamplesList = new ArrayList<>(oldSamples);
|
||||
ArrayList<DecimalQuantity> expectedSamplesList = new ArrayList<>(Arrays.asList(expected));
|
||||
|
||||
if (!assertEquals("getOldSamples; " + keyword + "; " + description, expectedSamplesList,
|
||||
oldSamplesList)) {
|
||||
|
@ -329,7 +328,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
"a:2,3,5,6,7,13,15,16,17", "a: n in 2..6,3..7", "a:2,3,4,5,6,7", };
|
||||
|
||||
private String[] getTargetStrings(String targets) {
|
||||
List list = new ArrayList(50);
|
||||
List<String> list = new ArrayList<>(50);
|
||||
String[] valSets = Utility.split(targets, ';');
|
||||
for (int i = 0; i < valSets.length; ++i) {
|
||||
String[] temp = Utility.split(valSets[i], ':');
|
||||
|
@ -459,7 +458,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
keywordToRule.put(keyword, singleRule);
|
||||
}
|
||||
|
||||
Map<DecimalQuantity, String> collisionTest = new LinkedHashMap();
|
||||
Map<DecimalQuantity, String> collisionTest = new LinkedHashMap<>();
|
||||
|
||||
// get all of the sample ranges from all of the samples
|
||||
Stream<DecimalQuantitySamplesRange> ranges = samples.stream()
|
||||
|
@ -474,7 +473,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
|
||||
items.forEach(item -> {
|
||||
collisionTest.clear();
|
||||
for (Entry<String, PluralRules> entry : keywordToRule.entrySet()) {
|
||||
for (Map.Entry<String, PluralRules> entry : keywordToRule.entrySet()) {
|
||||
PluralRules rule = entry.getValue();
|
||||
String foundKeyword = rule.select(item);
|
||||
if (foundKeyword.equals("other")) {
|
||||
|
@ -724,7 +723,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
@Test
|
||||
public void testAvailableULocales() {
|
||||
ULocale[] locales = factory.getAvailableULocales();
|
||||
Set localeSet = new HashSet();
|
||||
Set<ULocale> localeSet = new HashSet<>();
|
||||
localeSet.addAll(Arrays.asList(locales));
|
||||
|
||||
assertEquals("locales are unique in list", locales.length, localeSet.size());
|
||||
|
@ -1072,7 +1071,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
}
|
||||
Collection<DecimalQuantity> values;
|
||||
if (valueList == null || valueList.length() == 0) {
|
||||
values = Collections.EMPTY_SET;
|
||||
values = Collections.emptySet();
|
||||
} else if ("null".equals(valueList)) {
|
||||
values = null;
|
||||
} else {
|
||||
|
@ -1186,7 +1185,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestKeywords() {
|
||||
Set<String> possibleKeywords = new LinkedHashSet(Arrays.asList("zero", "one", "two", "few", "many", "other"));
|
||||
Set<String> possibleKeywords = new LinkedHashSet<>(Arrays.asList("zero", "one", "two", "few", "many", "other"));
|
||||
DecimalQuantity ONE_INTEGER = DecimalQuantity_DualStorageBCD.fromExponentString("1");
|
||||
Object[][][] tests = {
|
||||
// format is locale, explicits, then triples of keyword, status, unique value.
|
||||
|
@ -1205,7 +1204,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
// NumberType numberType = (NumberType) test[1];
|
||||
Set<DecimalQuantity> explicits = (Set<DecimalQuantity>) test[0][1];
|
||||
PluralRules pluralRules = factory.forLocale(locale);
|
||||
LinkedHashSet<String> remaining = new LinkedHashSet(possibleKeywords);
|
||||
LinkedHashSet<String> remaining = new LinkedHashSet<>(possibleKeywords);
|
||||
for (int i = 1; i < test.length; ++i) {
|
||||
Object[] row = test[i];
|
||||
String keyword = (String) row[0];
|
||||
|
@ -1536,7 +1535,7 @@ public class PluralRulesTest extends CoreTestFmwk {
|
|||
setsToRules.put(set, pr);
|
||||
data.put(pr, locale);
|
||||
}
|
||||
for (Entry<Set<StandardPluralCategories>, Set<PluralRules>> entry1 : setsToRules.keyValuesSet()) {
|
||||
for (Map.Entry<Set<StandardPluralCategories>, Set<PluralRules>> entry1 : setsToRules.keyValuesSet()) {
|
||||
Set<StandardPluralCategories> set = entry1.getKey();
|
||||
Set<PluralRules> rules = entry1.getValue();
|
||||
System.out.println("\n // " + set);
|
||||
|
|
|
@ -1001,7 +1001,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
// This tests passing named arguments instead of numbers to format().
|
||||
@Test
|
||||
public void testFormatNamedArguments() {
|
||||
Map arguments = new HashMap();
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("startDate", new Date(871068000000L));
|
||||
|
||||
StringBuffer result = new StringBuffer();
|
||||
|
@ -1035,7 +1035,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
String source = "abc =sep= def";
|
||||
|
||||
try {
|
||||
Map fmt_map = msg.parseToMap(source);
|
||||
Map<String, Object> fmt_map = msg.parseToMap(source);
|
||||
if (fmt_map.keySet().size() != 2) {
|
||||
errln("*** MSG parse (ustring, count, err) count err.");
|
||||
} else {
|
||||
|
@ -1047,7 +1047,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
}
|
||||
|
||||
ParsePosition pp = new ParsePosition(0);
|
||||
Map fmt_map = msg.parseToMap(source, pp);
|
||||
Map<String, Object> fmt_map = msg.parseToMap(source, pp);
|
||||
if (pp.getIndex()==0 || fmt_map==null) {
|
||||
errln("*** MSG parse (ustring, parsepos., count) error.");
|
||||
} else {
|
||||
|
@ -1061,7 +1061,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
|
||||
pp.setIndex(0);
|
||||
|
||||
Map fmta = (Map) msg.parseObject( source, pp );
|
||||
Map<String, Object> fmta = (Map<String, Object>) msg.parseObject( source, pp );
|
||||
if (pp.getIndex() == 0) {
|
||||
errln("*** MSG parse (ustring, Object, parsepos ) error.");
|
||||
} else {
|
||||
|
@ -1229,7 +1229,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
errln("should not use named arguments");
|
||||
}
|
||||
|
||||
Map map12 = new HashMap();
|
||||
Map<String, Object> map12 = new HashMap<>();
|
||||
map12.put("1", "one");
|
||||
map12.put("2", "two");
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
}
|
||||
|
||||
try {
|
||||
Map mapResult = mf.parseToMap(target);
|
||||
Map<String, Object> mapResult = mf.parseToMap(target);
|
||||
if (!map12.equals(mapResult)) {
|
||||
errln("expected " + map12 + " but got " + mapResult);
|
||||
}
|
||||
|
@ -1248,7 +1248,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
errln("unexpected exception: " + e.getMessage());
|
||||
}
|
||||
|
||||
Map map10 = new HashMap();
|
||||
Map<String, Object> map10 = new HashMap<>();
|
||||
map10.put("1", "one");
|
||||
map10.put("0", "zero");
|
||||
target = "X:{2} Y:one";
|
||||
|
@ -1259,7 +1259,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
|
||||
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM);
|
||||
DateFormat timeFormat = DateFormat.getTimeInstance(DateFormat.MEDIUM);
|
||||
Map fmtMap = new HashMap();
|
||||
Map<String, Format> fmtMap = new HashMap<>();
|
||||
fmtMap.put("1", dateFormat);
|
||||
fmtMap.put("2", timeFormat);
|
||||
mf.setFormatsByArgumentName(fmtMap);
|
||||
|
@ -1272,7 +1272,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
// expect this
|
||||
}
|
||||
|
||||
Map argMap = new HashMap();
|
||||
Map<String, Object> argMap = new HashMap<>();
|
||||
argMap.put("1", date);
|
||||
argMap.put("2", date);
|
||||
target = "X:5:17:00\u202FAM Y:Dec 17, 1990";
|
||||
|
@ -1291,7 +1291,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
"other {Ce sont # fichiers}} dans la liste.",
|
||||
new ULocale("fr"));
|
||||
Object objArray[] = {0L};
|
||||
HashMap objMap = new HashMap();
|
||||
HashMap<String, Object> objMap = new HashMap<>();
|
||||
objMap.put("argument", objArray[0]);
|
||||
String result = msgFmt.format(objArray);
|
||||
if (!result.equals("C'est 0,0 fichier dans la liste.")) {
|
||||
|
@ -1316,7 +1316,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
"sont # fichiers}} dans la liste.",
|
||||
new ULocale("fr"));
|
||||
Object objArray[] = {0L};
|
||||
HashMap objMap = new HashMap();
|
||||
HashMap<String, Object> objMap = new HashMap<>();
|
||||
objMap.put("argument", objArray[0]);
|
||||
String result = mfNum.format(objArray);
|
||||
if (!result.equals(mfAlpha.format(objMap))) {
|
||||
|
@ -1339,7 +1339,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
"zavodov}} in the directory.",
|
||||
new ULocale("uk"));
|
||||
Object objArray[] = {4L};
|
||||
HashMap objMap = new HashMap();
|
||||
HashMap<String, Object> objMap = new HashMap<>();
|
||||
objMap.put("argument", objArray[0]);
|
||||
String result = mfNum.format(objArray);
|
||||
if (!result.equals(mfAlpha.format(objMap))) {
|
||||
|
@ -1586,12 +1586,12 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
final SimpleDateFormat dateFormat = new SimpleDateFormat("'year:'yy 'month:'MM 'day:'dd");
|
||||
dateFormat.setTimeZone(TimeZone.getTimeZone("Etc/GMT"));
|
||||
ms.setFormatByArgumentName("date", dateFormat);
|
||||
Map map = new HashMap();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
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);
|
||||
Set formatNames = ms.getArgumentNames();
|
||||
Set<String> formatNames = ms.getArgumentNames();
|
||||
assertEquals("Format Names match", formatNames, map.keySet());
|
||||
assertEquals("Decimal", decimalFormat, ms.getFormatByArgumentName("number"));
|
||||
assertEquals("Date", dateFormat, ms.getFormatByArgumentName("date"));
|
||||
|
@ -1619,7 +1619,7 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
|
||||
Object[] args0 = new Object[] { "tmp", new Date(1184777888000L), 15, 2 };
|
||||
|
||||
HashMap args1 = new HashMap();
|
||||
HashMap<String, Object> args1 = new HashMap<>();
|
||||
args1.put("arg0", "tmp");
|
||||
args1.put("arg1", new Date(1184777888000L));
|
||||
args1.put("arg2", 15);
|
||||
|
@ -1680,12 +1680,12 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
AttributedCharacterIterator expectedAcit = expectedAttributedStrings[i].getIterator();
|
||||
|
||||
// Check available attributes
|
||||
Set attrSet = acit.getAllAttributeKeys();
|
||||
Set expectedAttrSet = expectedAcit.getAllAttributeKeys();
|
||||
Set<AttributedCharacterIterator.Attribute> attrSet = acit.getAllAttributeKeys();
|
||||
Set<AttributedCharacterIterator.Attribute> expectedAttrSet = expectedAcit.getAllAttributeKeys();
|
||||
if (attrSet.size() != expectedAttrSet.size()) {
|
||||
errln("FAIL: Number of attribute keys is " + attrSet.size() + " expected: " + expectedAttrSet.size());
|
||||
}
|
||||
Iterator attrIterator = attrSet.iterator();
|
||||
Iterator<AttributedCharacterIterator.Attribute> attrIterator = attrSet.iterator();
|
||||
while (attrIterator.hasNext()) {
|
||||
AttributedCharacterIterator.Attribute attr = (AttributedCharacterIterator.Attribute) attrIterator
|
||||
.next();
|
||||
|
@ -1708,16 +1708,16 @@ public class TestMessageFormat extends CoreTestFmwk {
|
|||
buf.append(c);
|
||||
expectedAcit.setIndex(indexExp);
|
||||
|
||||
Map attrs = acit.getAttributes();
|
||||
Map attrsExp = expectedAcit.getAttributes();
|
||||
Map<AttributedCharacterIterator.Attribute, Object> attrs = acit.getAttributes();
|
||||
Map<AttributedCharacterIterator.Attribute, Object> attrsExp = expectedAcit.getAttributes();
|
||||
if (attrs.size() != attrsExp.size()) {
|
||||
errln("FAIL: Number of attributes associated with index " + index + " is " + attrs.size()
|
||||
+ " expected: " + attrsExp.size());
|
||||
} else {
|
||||
// Check all attributes at the index
|
||||
Iterator entryIterator = attrsExp.entrySet().iterator();
|
||||
Iterator<Map.Entry<AttributedCharacterIterator.Attribute, Object>> entryIterator = attrsExp.entrySet().iterator();
|
||||
while (entryIterator.hasNext()) {
|
||||
Map.Entry entry = (Map.Entry) entryIterator.next();
|
||||
Map.Entry<AttributedCharacterIterator.Attribute, Object> entry = entryIterator.next();
|
||||
if (attrs.containsKey(entry.getKey())) {
|
||||
Object value = attrs.get(entry.getKey());
|
||||
assertEquals("Attribute value at index " + index, entry.getValue(), value);
|
||||
|
|
|
@ -275,10 +275,10 @@ public class TimeZoneFormatTest extends CoreTestFmwk {
|
|||
} else {
|
||||
// Specific or generic: raw offset must be preserved.
|
||||
if (inOffsets[0] != outOffsets[0] ) {
|
||||
if ((LOCALES[locidx].toString().equals("tg") || LOCALES[locidx].toString().equals("tg_TJ"))
|
||||
&& logKnownIssue("ICU-22857", "Time zone round test fails for tg/tg_TJ")) {
|
||||
continue;
|
||||
}
|
||||
if ((LOCALES[locidx].toString().equals("tg") || LOCALES[locidx].toString().equals("tg_TJ"))
|
||||
&& logKnownIssue("ICU-22857", "Time zone round test fails for tg/tg_TJ")) {
|
||||
continue;
|
||||
}
|
||||
if (JDKTZ && tzids[tzidx].startsWith("SystemV/")) {
|
||||
// JDK uses rule SystemV for these zones while
|
||||
// ICU handles these zones as aliases of existing time zones
|
||||
|
@ -1233,7 +1233,7 @@ public class TimeZoneFormatTest extends CoreTestFmwk {
|
|||
long date = System.currentTimeMillis();
|
||||
TimeZoneNames.Factory factory;
|
||||
try {
|
||||
Class cls = Class.forName("com.ibm.icu.text.TimeZoneNames$DefaultTimeZoneNames$FactoryImpl");
|
||||
Class<?> cls = Class.forName("com.ibm.icu.text.TimeZoneNames$DefaultTimeZoneNames$FactoryImpl");
|
||||
factory = (Factory) cls.newInstance();
|
||||
} catch (Exception e) {
|
||||
errln("Could not create class DefaultTimeZoneNames.FactoryImpl: " + e.getClass() + ": " + e.getMessage());
|
||||
|
|
|
@ -5900,7 +5900,7 @@ public class NumberFormatterApiTest extends CoreTestFmwk {
|
|||
|
||||
// We require that the upper bounds all be 999 inclusive.
|
||||
// The lower bound may be either -1, 0, or 1.
|
||||
Set<String> methodsWithLowerBound1 = new HashSet();
|
||||
Set<String> methodsWithLowerBound1 = new HashSet<>();
|
||||
methodsWithLowerBound1.add("fixedSignificantDigits");
|
||||
methodsWithLowerBound1.add("minSignificantDigits");
|
||||
methodsWithLowerBound1.add("maxSignificantDigits");
|
||||
|
@ -5914,7 +5914,7 @@ public class NumberFormatterApiTest extends CoreTestFmwk {
|
|||
// maxFraction
|
||||
// minMaxFraction
|
||||
// zeroFillTo
|
||||
Set<String> methodsWithLowerBoundN1 = new HashSet();
|
||||
Set<String> methodsWithLowerBoundN1 = new HashSet<>();
|
||||
methodsWithLowerBoundN1.add("truncateAt");
|
||||
|
||||
// Some of the methods require an object to be called upon.
|
||||
|
|
|
@ -126,7 +126,7 @@ public class CompatibilityTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
private List<FileHolder> getFileList(URL dataURL) throws IOException {
|
||||
List<FileHolder> classList = new ArrayList();
|
||||
List<FileHolder> classList = new ArrayList<>();
|
||||
|
||||
File topDir = new File(dataURL.getPath());
|
||||
File dataDirs[] = topDir.listFiles(new FileFilter() {
|
||||
|
@ -157,7 +157,7 @@ public class CompatibilityTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
private List<FileHolder> getJarList(URL jarURL) throws IOException {
|
||||
List<FileHolder> classList = new ArrayList();
|
||||
List<FileHolder> classList = new ArrayList<>();
|
||||
|
||||
String prefix = jarURL.getPath();
|
||||
int ix = prefix.indexOf("!/");
|
||||
|
@ -175,7 +175,7 @@ public class CompatibilityTest extends CoreTestFmwk
|
|||
|
||||
JarURLConnection conn = (JarURLConnection) jarURL.openConnection();
|
||||
jarFile = conn.getJarFile();
|
||||
Enumeration entries = jarFile.entries();
|
||||
Enumeration<JarEntry> entries = jarFile.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
JarEntry entry = (JarEntry) entries.nextElement();
|
||||
if (!entry.isDirectory()) {
|
||||
|
|
|
@ -32,7 +32,7 @@ public class CoverageTest extends CoreTestFmwk {
|
|||
@Test
|
||||
@Parameters(method="generateClassList")
|
||||
public void testSerialization(String className) throws ClassNotFoundException, IOException {
|
||||
Class c = Class.forName(className);
|
||||
Class<?> c = Class.forName(className);
|
||||
int m = c.getModifiers();
|
||||
|
||||
Handler classHandler = SerializableTestUtility.getHandler(className);
|
||||
|
|
|
@ -67,8 +67,8 @@ public class FormatHandler
|
|||
* of ICU4J to another. To guard against this, we store the following canned
|
||||
* data into the test objects we create.
|
||||
*/
|
||||
static HashMap cannedMonthNames = new HashMap();
|
||||
static HashMap cannedShortMonthNames = new HashMap();
|
||||
static HashMap<String, String[]> cannedMonthNames = new HashMap<>();
|
||||
static HashMap<String, String[]> cannedShortMonthNames = new HashMap<>();
|
||||
|
||||
static String en_CA_MonthNames[] = {
|
||||
"January",
|
||||
|
@ -742,7 +742,7 @@ public class FormatHandler
|
|||
* of ICU4J to another. To guard against this, we store the following canned
|
||||
* data into the test objects we create.
|
||||
*/
|
||||
static HashMap cannedDecimalFormatSymbols = new HashMap();
|
||||
static HashMap<String, String[]> cannedDecimalFormatSymbols = new HashMap<>();
|
||||
|
||||
static String en_CA_StringSymbols[] = {
|
||||
"$",
|
||||
|
@ -1582,7 +1582,7 @@ public class FormatHandler
|
|||
"%%lenient-parse:\n" +
|
||||
"& ':' = '.' = ' ' = '-';\n";
|
||||
|
||||
HashMap cannedData = new HashMap();
|
||||
HashMap<String, String> cannedData = new HashMap<>();
|
||||
|
||||
{
|
||||
cannedData.put("en_CA/SpelloutRules", en_SpelloutRules);
|
||||
|
@ -1880,7 +1880,7 @@ public class FormatHandler
|
|||
|
||||
public static class DateFormatHandler implements SerializableTestUtility.Handler
|
||||
{
|
||||
static HashMap cannedPatterns = new HashMap();
|
||||
static HashMap<String, String> cannedPatterns = new HashMap<>();
|
||||
static Date fixedDate;
|
||||
|
||||
{
|
||||
|
|
|
@ -34,7 +34,7 @@ import com.ibm.icu.impl.URLHandler;
|
|||
*/
|
||||
public class SerializableChecker implements URLHandler.URLVisitor
|
||||
{
|
||||
private static Class serializable;
|
||||
private static Class<?> serializable;
|
||||
//private static Class throwable;
|
||||
|
||||
private String path = null;
|
||||
|
@ -90,7 +90,7 @@ public class SerializableChecker implements URLHandler.URLVisitor
|
|||
}
|
||||
|
||||
try {
|
||||
Class c = Class.forName(className);
|
||||
Class<?> c = Class.forName(className);
|
||||
int m = c.getModifiers();
|
||||
|
||||
if (serializable.isAssignableFrom(c) /*&&
|
||||
|
@ -172,10 +172,10 @@ public class SerializableChecker implements URLHandler.URLVisitor
|
|||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
List argList = Arrays.asList(args);
|
||||
List<String> argList = Arrays.asList(args);
|
||||
String path = null;
|
||||
|
||||
for (Iterator it = argList.iterator(); it.hasNext(); /*anything?*/) {
|
||||
for (Iterator<String> it = argList.iterator(); it.hasNext(); /*anything?*/) {
|
||||
String arg = (String) it.next();
|
||||
|
||||
if (arg.equals("-w")) {
|
||||
|
|
|
@ -66,7 +66,7 @@ import com.ibm.icu.util.VTimeZone;
|
|||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
*/
|
||||
public class SerializableTestUtility {
|
||||
private static Class serializable;
|
||||
private static Class<?> serializable;
|
||||
static {
|
||||
try {
|
||||
serializable = Class.forName("java.io.Serializable");
|
||||
|
@ -772,7 +772,7 @@ public class SerializableTestUtility {
|
|||
}
|
||||
}
|
||||
|
||||
private static HashMap map = new HashMap();
|
||||
private static HashMap<String, Handler> map = new HashMap<>();
|
||||
|
||||
static {
|
||||
map.put("com.ibm.icu.util.TimeZone", new TimeZoneHandler());
|
||||
|
@ -914,7 +914,7 @@ public class SerializableTestUtility {
|
|||
}
|
||||
|
||||
static List<String> getSerializationClassList(Object caller) throws IOException {
|
||||
List<String> classList = new ArrayList();
|
||||
List<String> classList = new ArrayList<>();
|
||||
Enumeration<URL> urlEnum = caller.getClass().getClassLoader().getResources("com/ibm/icu");
|
||||
while (urlEnum.hasMoreElements()) {
|
||||
URL url = urlEnum.nextElement();
|
||||
|
@ -951,7 +951,7 @@ public class SerializableTestUtility {
|
|||
if (className.startsWith("com.ibm.icu.dev.")) {
|
||||
return;
|
||||
}
|
||||
Class c;
|
||||
Class<?> c;
|
||||
try {
|
||||
c = Class.forName(className);
|
||||
} catch (ClassNotFoundException e) {
|
||||
|
|
|
@ -799,7 +799,7 @@ public class CurrencyTest extends CoreTestFmwk {
|
|||
};
|
||||
|
||||
String[] ALL = Currency.getKeywordValuesForLocale("currency", ULocale.getDefault(), false);
|
||||
HashSet ALLSET = new HashSet();
|
||||
HashSet<String> ALLSET = new HashSet<>();
|
||||
for (int i = 0; i < ALL.length; i++) {
|
||||
ALLSET.add(ALL[i]);
|
||||
}
|
||||
|
|
|
@ -53,9 +53,9 @@ public final class ICUResourceBundleTest extends CoreTestFmwk {
|
|||
// It does not work well in eclipse plug-in test because of class loader configuration??
|
||||
// For now, specify resource path explicitly in this test case
|
||||
//Enumeration en = testLoader.getResources("META-INF");
|
||||
Enumeration en = testLoader.getResources("com.ibm.icu.dev.data");
|
||||
Enumeration<URL> en = testLoader.getResources("com.ibm.icu.dev.data");
|
||||
for(;en.hasMoreElements();) {
|
||||
URL url = (URL)en.nextElement();
|
||||
URL url = en.nextElement();
|
||||
if (url == null) {
|
||||
warnln("could not load resource data");
|
||||
return;
|
||||
|
@ -903,7 +903,7 @@ public final class ICUResourceBundleTest extends CoreTestFmwk {
|
|||
@Override
|
||||
protected UResourceBundle getParent() {return null;}
|
||||
@Override
|
||||
public Enumeration getKeys() {return null;}
|
||||
public Enumeration<String> getKeys() {return null;}
|
||||
@Override
|
||||
protected Object handleGetObject(String aKey) {return null;}
|
||||
}
|
||||
|
@ -965,7 +965,7 @@ public final class ICUResourceBundleTest extends CoreTestFmwk {
|
|||
}
|
||||
//reset the default
|
||||
ULocale.setDefault(defaultLocale);
|
||||
Enumeration keys = bundle.getKeys();
|
||||
Enumeration<String> keys = bundle.getKeys();
|
||||
int i=0;
|
||||
while(keys.hasMoreElements()){
|
||||
logln("key: "+ keys.nextElement());
|
||||
|
@ -1198,7 +1198,7 @@ public final class ICUResourceBundleTest extends CoreTestFmwk {
|
|||
// enrure is that we don't crash with a StackOverflowError when trying to retrieve the bundle
|
||||
}
|
||||
ULocale.setDefault(oldDefaultLocale);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestPersonUnits() {
|
||||
|
|
|
@ -18,7 +18,6 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.SortedMap;
|
||||
|
||||
|
@ -71,7 +70,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
* the locale as the comparator to sort the display names, and null for
|
||||
* the matchID.
|
||||
*/
|
||||
public SortedMap getDisplayNames(ICUService service) {
|
||||
public SortedMap<String, String> getDisplayNames(ICUService service) {
|
||||
ULocale locale = ULocale.getDefault();
|
||||
Collator col = Collator.getInstance(locale.toLocale());
|
||||
return service.getDisplayNames(locale, col, null);
|
||||
|
@ -82,7 +81,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
* uses the default collator for the locale as the comparator to
|
||||
* sort the display names, and null for the matchID.
|
||||
*/
|
||||
public SortedMap getDisplayNames(ICUService service, ULocale locale) {
|
||||
public SortedMap<String, String> getDisplayNames(ICUService service, ULocale locale) {
|
||||
Collator col = Collator.getInstance(locale.toLocale());
|
||||
return service.getDisplayNames(locale, col, null);
|
||||
}
|
||||
|
@ -91,7 +90,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
* uses the default collator for the locale as the comparator to
|
||||
* sort the display names.
|
||||
*/
|
||||
public SortedMap getDisplayNames(ICUService service, ULocale locale, String matchID) {
|
||||
public SortedMap<String, String> getDisplayNames(ICUService service, ULocale locale, String matchID) {
|
||||
Collator col = Collator.getInstance(locale.toLocale());
|
||||
return service.getDisplayNames(locale, col, matchID);
|
||||
}
|
||||
|
@ -136,7 +135,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
confirmIdentical("3) en_US_BAR -> en_US", result, singleton0);
|
||||
|
||||
// get a list of the factories, should be two
|
||||
List factories = service.factories();
|
||||
List<Factory> factories = service.factories();
|
||||
confirmIdentical("4) factory size", factories.size(), 2);
|
||||
|
||||
// register a new object with yet another locale
|
||||
|
@ -194,7 +193,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
confirmIdentical("17) get invisible", result, singleton4);
|
||||
|
||||
// should not be able to locate invisible services
|
||||
Set ids = service.getVisibleIDs();
|
||||
Set<String> ids = service.getVisibleIDs();
|
||||
confirmBoolean("18) find invisible", !ids.contains("en_US_BAR"));
|
||||
|
||||
service.reset();
|
||||
|
@ -207,7 +206,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateVisibleIDs(Map unusedResult) {
|
||||
public void updateVisibleIDs(Map<String, Factory> unusedResult) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -249,13 +248,13 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
|
||||
// iterate over the visual ids returned by the multiple factory
|
||||
{
|
||||
Set vids = service.getVisibleIDs();
|
||||
Iterator iter = vids.iterator();
|
||||
Set<String> vids = service.getVisibleIDs();
|
||||
Iterator<String> iter = vids.iterator();
|
||||
int count = 0;
|
||||
while (iter.hasNext()) {
|
||||
++count;
|
||||
String id = (String)iter.next();
|
||||
logln(" " + id + " --> " + service.get(id));
|
||||
++count;
|
||||
String id = (String)iter.next();
|
||||
logln(" " + id + " --> " + service.get(id));
|
||||
}
|
||||
// four visible ids
|
||||
confirmIdentical("25) visible ids", count, 4);
|
||||
|
@ -263,13 +262,13 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
|
||||
// iterate over the display names
|
||||
{
|
||||
Map dids = getDisplayNames(service, ULocale.GERMANY);
|
||||
Iterator iter = dids.entrySet().iterator();
|
||||
Map<String, String> dids = getDisplayNames(service, ULocale.GERMANY);
|
||||
Iterator<Map.Entry<String, String>> iter = dids.entrySet().iterator();
|
||||
int count = 0;
|
||||
while (iter.hasNext()) {
|
||||
++count;
|
||||
Entry e = (Entry)iter.next();
|
||||
logln(" " + e.getKey() + " -- > " + e.getValue());
|
||||
++count;
|
||||
Map.Entry<String, String> e = iter.next();
|
||||
logln(" " + e.getKey() + " -- > " + e.getValue());
|
||||
}
|
||||
// four display names, in german
|
||||
confirmIdentical("26) display names", count, 4);
|
||||
|
@ -294,13 +293,13 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
// this time, we have seven display names
|
||||
// Rad dude's surfer gal 'replaces' later's surfer gal
|
||||
{
|
||||
Map dids = getDisplayNames(service);
|
||||
Iterator iter = dids.entrySet().iterator();
|
||||
Map<String, String> dids = getDisplayNames(service);
|
||||
Iterator<Map.Entry<String, String>> iter = dids.entrySet().iterator();
|
||||
int count = 0;
|
||||
while (iter.hasNext()) {
|
||||
++count;
|
||||
Entry e = (Entry)iter.next();
|
||||
logln(" " + e.getKey() + " --> " + e.getValue());
|
||||
++count;
|
||||
Map.Entry<String, String> e = iter.next();
|
||||
logln(" " + e.getKey() + " --> " + e.getValue());
|
||||
}
|
||||
// seven display names, in spanish
|
||||
confirmIdentical("29) display names", count, 7);
|
||||
|
@ -372,11 +371,11 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
*/
|
||||
|
||||
{
|
||||
Set xids = service.getVisibleIDs();
|
||||
Iterator iter = xids.iterator();
|
||||
Set<String> xids = service.getVisibleIDs();
|
||||
Iterator<String> iter = xids.iterator();
|
||||
while (iter.hasNext()) {
|
||||
String xid = (String)iter.next();
|
||||
logln(xid + "? " + service.get(xid));
|
||||
String xid = (String)iter.next();
|
||||
logln(xid + "? " + service.get(xid));
|
||||
}
|
||||
|
||||
logln("valleygirl? " + service.get("en_US_VALLEY_GIRL"));
|
||||
|
@ -426,26 +425,26 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
// list the display names in reverse order
|
||||
{
|
||||
logln("display names in reverse order: " +
|
||||
service.getDisplayNames(ULocale.US, new Comparator() {
|
||||
@Override
|
||||
service.getDisplayNames(ULocale.US, new Comparator<Object>() {
|
||||
@Override
|
||||
public int compare(Object lhs, Object rhs) {
|
||||
return -String.CASE_INSENSITIVE_ORDER.compare((String)lhs, (String)rhs);
|
||||
}
|
||||
}));
|
||||
return -String.CASE_INSENSITIVE_ORDER.compare((String)lhs, (String)rhs);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
// get all the display names of these resources
|
||||
// this should be fast since the display names were cached.
|
||||
{
|
||||
logln("service display names for de_DE");
|
||||
Map names = getDisplayNames(service, new ULocale("de_DE"));
|
||||
logln("service display names for de_DE");
|
||||
Map<String, String> names = getDisplayNames(service, new ULocale("de_DE"));
|
||||
StringBuffer buf = new StringBuffer("{");
|
||||
Iterator iter = names.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, String>> iter = names.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry e = (Entry)iter.next();
|
||||
String name = (String)e.getKey();
|
||||
String id = (String)e.getValue();
|
||||
buf.append("\n " + name + " --> " + id);
|
||||
Map.Entry<String, String> e = iter.next();
|
||||
String name = e.getKey();
|
||||
String id = e.getValue();
|
||||
buf.append("\n " + name + " --> " + id);
|
||||
}
|
||||
buf.append("\n}");
|
||||
logln(buf.toString());
|
||||
|
@ -466,12 +465,12 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
for (int i = 0; i < idNames.length; ++i) {
|
||||
String idName = idNames[i];
|
||||
buf.append("\n --- " + idName + " ---");
|
||||
Map names = getDisplayNames(service, new ULocale(idName));
|
||||
Iterator iter = names.entrySet().iterator();
|
||||
Map<String, String> names = getDisplayNames(service, new ULocale(idName));
|
||||
Iterator<Map.Entry<String, String>> iter = names.entrySet().iterator();
|
||||
while (iter.hasNext()) {
|
||||
Entry e = (Entry)iter.next();
|
||||
String name = (String)e.getKey();
|
||||
String id = (String)e.getValue();
|
||||
Map.Entry<String, String> e = iter.next();
|
||||
String name = e.getKey();
|
||||
String id = e.getValue();
|
||||
buf.append("\n " + name + " --> " + id);
|
||||
}
|
||||
}
|
||||
|
@ -550,13 +549,13 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
static class TestLocaleKeyFactory extends LocaleKeyFactory {
|
||||
protected final Set ids;
|
||||
protected final Set<String> ids;
|
||||
protected final String factoryID;
|
||||
|
||||
public TestLocaleKeyFactory(String[] ids, String factoryID) {
|
||||
super(VISIBLE, factoryID);
|
||||
|
||||
this.ids = Collections.unmodifiableSet(new HashSet(Arrays.asList(ids)));
|
||||
this.ids = Collections.unmodifiableSet(new HashSet<>(Arrays.asList(ids)));
|
||||
this.factoryID = factoryID + ": ";
|
||||
}
|
||||
|
||||
|
@ -566,7 +565,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Set getSupportedIDs() {
|
||||
protected Set<String> getSupportedIDs() {
|
||||
return ids;
|
||||
}
|
||||
}
|
||||
|
@ -626,19 +625,19 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
public static String valley = californio + "_VALLEY";
|
||||
public static String surfer = californio + "_SURFER";
|
||||
public static String geek = californio + "_GEEK";
|
||||
public static Set supportedIDs;
|
||||
public static Set<String> supportedIDs;
|
||||
static {
|
||||
HashSet result = new HashSet();
|
||||
HashSet<String> result = new HashSet<>();
|
||||
result.addAll(ICUResourceBundle.getAvailableLocaleNameSet());
|
||||
result.add(californio);
|
||||
result.add(valley);
|
||||
result.add(surfer);
|
||||
result.add(geek);
|
||||
result.add(californio);
|
||||
result.add(valley);
|
||||
result.add(surfer);
|
||||
result.add(geek);
|
||||
supportedIDs = Collections.unmodifiableSet(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set getSupportedIDs() {
|
||||
public Set<String> getSupportedIDs() {
|
||||
return supportedIDs;
|
||||
}
|
||||
|
||||
|
@ -745,15 +744,13 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
target = service.get("za_PPP");
|
||||
confirmEqual("test with ja locale", "japanese", target);
|
||||
|
||||
Set ids = service.getVisibleIDs();
|
||||
for (Iterator iter = ids.iterator(); iter.hasNext();) {
|
||||
logln("id: " + iter.next());
|
||||
for (String id : service.getVisibleIDs()) {
|
||||
logln("id: " + id);
|
||||
}
|
||||
|
||||
ULocale.setDefault(loc);
|
||||
ids = service.getVisibleIDs();
|
||||
for (Iterator iter = ids.iterator(); iter.hasNext();) {
|
||||
logln("id: " + iter.next());
|
||||
for (String id : service.getVisibleIDs()) {
|
||||
logln("id: " + id);
|
||||
}
|
||||
|
||||
target = service.get("za_PPP");
|
||||
|
@ -772,8 +769,8 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
|
||||
{
|
||||
int n = 0;
|
||||
List factories = service.factories();
|
||||
Iterator iter = factories.iterator();
|
||||
List<Factory> factories = service.factories();
|
||||
Iterator<Factory> iter = factories.iterator();
|
||||
while (iter.hasNext()) {
|
||||
logln("[" + n++ + "] " + iter.next());
|
||||
}
|
||||
|
@ -783,14 +780,14 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
// since we're using locale keys, we should get all and only the es locales
|
||||
// hmmm, the default toString function doesn't print in sorted order for TreeMap
|
||||
{
|
||||
SortedMap map = service.getDisplayNames(ULocale.US,
|
||||
new Comparator() {
|
||||
@Override
|
||||
public int compare(Object lhs, Object rhs) {
|
||||
SortedMap<String, String> map = service.getDisplayNames(ULocale.US,
|
||||
new Comparator<Object>() {
|
||||
@Override
|
||||
public int compare(Object lhs, Object rhs) {
|
||||
return -String.CASE_INSENSITIVE_ORDER.compare((String)lhs, (String)rhs);
|
||||
}
|
||||
},
|
||||
"es");
|
||||
}
|
||||
},
|
||||
"es");
|
||||
|
||||
logln("es display names in reverse order " + map);
|
||||
}
|
||||
|
@ -817,7 +814,7 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
@Override
|
||||
public void updateVisibleIDs(Map result) {
|
||||
public void updateVisibleIDs(Map<String, Factory> result) {
|
||||
result.put("greeting", this);
|
||||
}
|
||||
|
||||
|
@ -950,13 +947,13 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
logln("obj: " + lkf.create(lkey, null));
|
||||
logln(lkf.getDisplayName("foo", null));
|
||||
logln(lkf.getDisplayName("bar", null));
|
||||
lkf.updateVisibleIDs(new HashMap());
|
||||
lkf.updateVisibleIDs(new HashMap<>());
|
||||
|
||||
LocaleKeyFactory invisibleLKF = new LKFSubclass(false);
|
||||
logln("obj: " + invisibleLKF.create(lkey, null));
|
||||
logln(invisibleLKF.getDisplayName("foo", null));
|
||||
logln(invisibleLKF.getDisplayName("bar", null));
|
||||
invisibleLKF.updateVisibleIDs(new HashMap());
|
||||
invisibleLKF.updateVisibleIDs(new HashMap<>());
|
||||
|
||||
// ResourceBundleFactory
|
||||
ICUResourceBundleFactory rbf = new ICUResourceBundleFactory();
|
||||
|
@ -1027,8 +1024,8 @@ public class ICUServiceTest extends CoreTestFmwk
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Set getSupportedIDs() {
|
||||
return Collections.EMPTY_SET;
|
||||
protected Set<String> getSupportedIDs() {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class LocaleDataTest extends CoreTestFmwk{
|
|||
|
||||
@Test
|
||||
public void TestExemplarSet(){
|
||||
HashSet testedExemplars = new HashSet();
|
||||
HashSet<ExemplarGroup> testedExemplars = new HashSet<>();
|
||||
int equalCount = 0;
|
||||
for(int i=0; i<availableLocales.length; i++){
|
||||
ULocale locale = availableLocales[i];
|
||||
|
@ -271,7 +271,7 @@ public class LocaleDataTest extends CoreTestFmwk{
|
|||
@Test
|
||||
public void TestExemplarSet2(){
|
||||
int equalCount = 0;
|
||||
HashSet testedExemplars = new HashSet();
|
||||
HashSet<ExemplarGroup> testedExemplars = new HashSet<>();
|
||||
for(int i=0; i<availableLocales.length; i++){
|
||||
ULocale locale = availableLocales[i];
|
||||
LocaleData ld = LocaleData.getInstance(locale);
|
||||
|
|
|
@ -407,9 +407,9 @@ public class ULocaleTest extends CoreTestFmwk {
|
|||
*/
|
||||
void checkObject(String requestedLocale, Object obj,
|
||||
String expReqValid, String expValidActual) {
|
||||
Class[] getLocaleParams = new Class[] { ULocale.Type.class };
|
||||
Class<?>[] getLocaleParams = new Class<?>[] { ULocale.Type.class };
|
||||
try {
|
||||
Class cls = obj.getClass();
|
||||
Class<?> cls = obj.getClass();
|
||||
Method getLocale = cls.getMethod("getLocale", getLocaleParams);
|
||||
ULocale valid = (ULocale) getLocale.invoke(obj, new Object[] {
|
||||
ULocale.VALID_LOCALE });
|
||||
|
@ -1490,12 +1490,12 @@ public class ULocaleTest extends CoreTestFmwk {
|
|||
logln("Testing locale " + localeID + " ...");
|
||||
ULocale loc = new ULocale(localeID);
|
||||
|
||||
Iterator it = loc.getKeywords();
|
||||
Iterator it2 = ULocale.getKeywords(localeID);
|
||||
Iterator<String> it = loc.getKeywords();
|
||||
Iterator<String> it2 = ULocale.getKeywords(localeID);
|
||||
//it and it2 are not equal here. No way to verify their equivalence yet.
|
||||
while(it.hasNext()) {
|
||||
String key = (String)it.next();
|
||||
String key2 = (String)it2.next();
|
||||
String key = it.next();
|
||||
String key2 = it2.next();
|
||||
if (!key.equals(key2)) {
|
||||
errln("FAIL: static and non-static getKeywords returned different results.");
|
||||
}
|
||||
|
@ -1678,7 +1678,8 @@ public class ULocaleTest extends CoreTestFmwk {
|
|||
}
|
||||
|
||||
//Hashtables for storing expected display of keys/types of locale in English and Chinese
|
||||
private static Map[] h = new Map[2];
|
||||
@SuppressWarnings("unchecked")
|
||||
private static Map<String, String>[] h = new Map[2];
|
||||
|
||||
private static final String ACCEPT_LANGUAGE_TESTS[][] = {
|
||||
/*# result fallback? */
|
||||
|
|
|
@ -21,7 +21,6 @@ import com.ibm.icu.dev.test.CoreTestFmwk;
|
|||
import com.ibm.icu.dev.test.TestFmwk;
|
||||
import com.ibm.icu.dev.test.TestUtil;
|
||||
import com.ibm.icu.dev.test.TestUtil.JavaVendor;
|
||||
import com.ibm.icu.math.BigDecimal;
|
||||
|
||||
/* ------------------------------------------------------------------ */
|
||||
/* Decimal diagnostic tests mfc */
|
||||
|
|
|
@ -7,8 +7,6 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ibm.icu.message2.MessageFormatter;
|
||||
|
||||
/**
|
||||
* Convenience class that provides the same functionality as
|
||||
* <code>Map.of</code> introduced in JDK 11, which can't be used yet for ICU4J.
|
||||
|
|
|
@ -6,7 +6,6 @@ package com.ibm.icu.dev.test;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
@ -120,7 +119,7 @@ public class UnicodeKnownIssues {
|
|||
return false;
|
||||
}
|
||||
logFn.accept("\n " + knownIssues.size() + " Known Issues:");
|
||||
for (Entry<String, List<String>> entry : knownIssues.entrySet()) {
|
||||
for (Map.Entry<String, List<String>> entry : knownIssues.entrySet()) {
|
||||
String ticketLink = entry.getKey();
|
||||
if (UNICODE_JIRA_PATTERN.matcher(ticketLink) != null) {
|
||||
logFn.accept(ticketLink + " <" + UNICODE_JIRA_BROWSE + ticketLink + ">");
|
||||
|
|
|
@ -66,12 +66,12 @@ public class IncrementalProgressTest extends TestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestIncrementalProgress() {
|
||||
Enumeration targets = Transliterator.getAvailableTargets(this.lang);
|
||||
Enumeration<String> targets = Transliterator.getAvailableTargets(this.lang);
|
||||
while(targets.hasMoreElements()) {
|
||||
String target = (String) targets.nextElement();
|
||||
Enumeration variants = Transliterator.getAvailableVariants(this.lang, target);
|
||||
String target = targets.nextElement();
|
||||
Enumeration<String> variants = Transliterator.getAvailableVariants(this.lang, target);
|
||||
while(variants.hasMoreElements()) {
|
||||
String variant = (String) variants.nextElement();
|
||||
String variant = variants.nextElement();
|
||||
String id = this.lang + "-" + target + "/" + variant;
|
||||
logln("id: " + id);
|
||||
|
||||
|
|
|
@ -184,9 +184,9 @@ public class RegexUtilitiesTest extends TestFmwk {
|
|||
String result;
|
||||
if (test.endsWith(".txt")) {
|
||||
java.io.InputStream is = RegexUtilitiesTest.class.getResourceAsStream(test);
|
||||
List lines;
|
||||
List<String> lines;
|
||||
try {
|
||||
lines = UnicodeRegex.appendLines(new ArrayList(), is, "UTF-8");
|
||||
lines = UnicodeRegex.appendLines(new ArrayList<>(), is, "UTF-8");
|
||||
} finally {
|
||||
is.close();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ package com.ibm.icu.dev.test.translit;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
|
@ -102,7 +101,7 @@ public class TransliteratorDisorderedMarksTest extends TestFmwk {
|
|||
}
|
||||
|
||||
|
||||
for (Entry<Integer, UnicodeSet> x : leadToSources.entrySet()) {
|
||||
for (Map.Entry<Integer, UnicodeSet> x : leadToSources.entrySet()) {
|
||||
Integer lead = x.getKey();
|
||||
UnicodeSet sources = x.getValue();
|
||||
UnicodeSet trailSet = leadToTrail.get(lead);
|
||||
|
|
|
@ -29,11 +29,11 @@ public class TransliteratorInstantiateAllTest extends TestFmwk {
|
|||
}
|
||||
|
||||
@Parameterized.Parameters
|
||||
public static Collection testData() {
|
||||
public static Collection<String> testData() {
|
||||
ArrayList<String> allTranslitIDs = new ArrayList<String>();
|
||||
|
||||
for (Enumeration e = Transliterator.getAvailableIDs(); e.hasMoreElements(); ) {
|
||||
String id = (String) e.nextElement();
|
||||
for (Enumeration<String> e = Transliterator.getAvailableIDs(); e.hasMoreElements(); ) {
|
||||
String id = e.nextElement();
|
||||
allTranslitIDs.add(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,8 +139,8 @@ public class TransliteratorTest extends TestFmwk {
|
|||
checkRegistry("foo3", "::[a-z]; ::NFC; [:letter:] a > b;"); // check compound
|
||||
checkRegistry("foo2", "::NFC; [:letter:] a > b;"); // check compound
|
||||
checkRegistry("foo1", "[:letter:] a > b;");
|
||||
for (Enumeration e = Transliterator.getAvailableIDs(); e.hasMoreElements(); ) {
|
||||
String id = (String) e.nextElement();
|
||||
for (Enumeration<String> e = Transliterator.getAvailableIDs(); e.hasMoreElements(); ) {
|
||||
String id = e.nextElement();
|
||||
checkRegistry(id);
|
||||
}
|
||||
// Need to remove these test-specific transliterators in order not to interfere with other tests.
|
||||
|
@ -1538,25 +1538,25 @@ public class TransliteratorTest extends TestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestSTV() {
|
||||
Enumeration es = Transliterator.getAvailableSources();
|
||||
Enumeration<String> es = Transliterator.getAvailableSources();
|
||||
for (int i=0; es.hasMoreElements(); ++i) {
|
||||
String source = (String) es.nextElement();
|
||||
String source = es.nextElement();
|
||||
logln("" + i + ": " + source);
|
||||
if (source.length() == 0) {
|
||||
errln("FAIL: empty source");
|
||||
continue;
|
||||
}
|
||||
Enumeration et = Transliterator.getAvailableTargets(source);
|
||||
Enumeration<String> et = Transliterator.getAvailableTargets(source);
|
||||
for (int j=0; et.hasMoreElements(); ++j) {
|
||||
String target = (String) et.nextElement();
|
||||
String target = et.nextElement();
|
||||
logln(" " + j + ": " + target);
|
||||
if (target.length() == 0) {
|
||||
errln("FAIL: empty target");
|
||||
continue;
|
||||
}
|
||||
Enumeration ev = Transliterator.getAvailableVariants(source, target);
|
||||
Enumeration<String> ev = Transliterator.getAvailableVariants(source, target);
|
||||
for (int k=0; ev.hasMoreElements(); ++k) {
|
||||
String variant = (String) ev.nextElement();
|
||||
String variant = ev.nextElement();
|
||||
if (variant.length() == 0) {
|
||||
logln(" " + k + ": <empty>");
|
||||
} else {
|
||||
|
@ -1599,25 +1599,25 @@ public class TransliteratorTest extends TestFmwk {
|
|||
}
|
||||
|
||||
// Make sure getAvailable API reflects removal
|
||||
for (Enumeration e = Transliterator.getAvailableIDs();
|
||||
for (Enumeration<String> e = Transliterator.getAvailableIDs();
|
||||
e.hasMoreElements(); ) {
|
||||
String id = (String) e.nextElement();
|
||||
String id = e.nextElement();
|
||||
for (int i=0; i<3; ++i) {
|
||||
if (id.equals(FULL_IDS[i])) {
|
||||
errln("FAIL: unregister(" + id + ") failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Enumeration e = Transliterator.getAvailableTargets("Any");
|
||||
for (Enumeration<String> e = Transliterator.getAvailableTargets("Any");
|
||||
e.hasMoreElements(); ) {
|
||||
String t = (String) e.nextElement();
|
||||
String t = e.nextElement();
|
||||
if (t.equals(IDS[0])) {
|
||||
errln("FAIL: unregister(Any-" + t + ") failed");
|
||||
}
|
||||
}
|
||||
for (Enumeration e = Transliterator.getAvailableSources();
|
||||
for (Enumeration<String> e = Transliterator.getAvailableSources();
|
||||
e.hasMoreElements(); ) {
|
||||
String s = (String) e.nextElement();
|
||||
String s = e.nextElement();
|
||||
for (int i=0; i<3; ++i) {
|
||||
if (SOURCES[i] == null) continue;
|
||||
if (s.equals(SOURCES[i])) {
|
||||
|
@ -2545,8 +2545,8 @@ public class TransliteratorTest extends TestFmwk {
|
|||
@Test
|
||||
public void TestScriptAllCodepoints(){
|
||||
int code;
|
||||
HashSet scriptIdsChecked = new HashSet();
|
||||
HashSet scriptAbbrsChecked = new HashSet();
|
||||
HashSet<String> scriptIdsChecked = new HashSet<>();
|
||||
HashSet<String> scriptAbbrsChecked = new HashSet<>();
|
||||
for( int i =0; i <= 0x10ffff; i++){
|
||||
code = UScript.getScript(i);
|
||||
if(code==UScript.INVALID_CODE){
|
||||
|
@ -2683,7 +2683,7 @@ public class TransliteratorTest extends TestFmwk {
|
|||
|
||||
static class DummyFactory implements Transliterator.Factory {
|
||||
static DummyFactory singleton = new DummyFactory();
|
||||
static HashMap m = new HashMap();
|
||||
static HashMap<String, Transliterator> m = new HashMap<>();
|
||||
|
||||
// Since Transliterators are immutable, we don't have to clone on set & get
|
||||
static void add(String ID, Transliterator t) {
|
||||
|
@ -2693,7 +2693,7 @@ public class TransliteratorTest extends TestFmwk {
|
|||
}
|
||||
@Override
|
||||
public Transliterator getInstance(String ID) {
|
||||
return (Transliterator) m.get(ID);
|
||||
return m.get(ID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2896,7 +2896,7 @@ public class TransliteratorTest extends TestFmwk {
|
|||
|
||||
static class TestUserFunctionFactory implements Transliterator.Factory {
|
||||
static TestUserFunctionFactory singleton = new TestUserFunctionFactory();
|
||||
static HashMap m = new HashMap();
|
||||
static HashMap<CaseInsensitiveString, Transliterator> m = new HashMap<>();
|
||||
|
||||
static void add(String ID, Transliterator t) {
|
||||
m.put(new CaseInsensitiveString(ID), t);
|
||||
|
@ -2905,13 +2905,13 @@ public class TransliteratorTest extends TestFmwk {
|
|||
|
||||
@Override
|
||||
public Transliterator getInstance(String ID) {
|
||||
return (Transliterator) m.get(new CaseInsensitiveString(ID));
|
||||
return m.get(new CaseInsensitiveString(ID));
|
||||
}
|
||||
|
||||
static void unregister() {
|
||||
Iterator ids = m.keySet().iterator();
|
||||
Iterator<CaseInsensitiveString> ids = m.keySet().iterator();
|
||||
while (ids.hasNext()) {
|
||||
CaseInsensitiveString id = (CaseInsensitiveString) ids.next();
|
||||
CaseInsensitiveString id = ids.next();
|
||||
Transliterator.unregister(id.getString());
|
||||
ids.remove(); // removes pair from m
|
||||
}
|
||||
|
|
|
@ -58,11 +58,11 @@ public class WriteCharts {
|
|||
}
|
||||
|
||||
public static String[] getAllScripts() {
|
||||
Set set = new TreeSet();
|
||||
Set<String> set = new TreeSet<>();
|
||||
int scripts[];
|
||||
Enumeration sources = Transliterator.getAvailableSources();
|
||||
Enumeration<String> sources = Transliterator.getAvailableSources();
|
||||
while(sources.hasMoreElements()) {
|
||||
String source = (String) sources.nextElement();
|
||||
String source = sources.nextElement();
|
||||
scripts = UScript.getCode(source);
|
||||
if (scripts == null) {
|
||||
System.out.println("[Skipping " + source + "]");
|
||||
|
@ -70,9 +70,9 @@ public class WriteCharts {
|
|||
}
|
||||
int sourceScript = scripts[0];
|
||||
System.out.println("Source: " + source + ";\tScripts: " + showScripts(scripts));
|
||||
Enumeration targets = Transliterator.getAvailableTargets(source);
|
||||
Enumeration<String> targets = Transliterator.getAvailableTargets(source);
|
||||
while(targets.hasMoreElements()) {
|
||||
String target = (String) targets.nextElement();
|
||||
String target = targets.nextElement();
|
||||
scripts = UScript.getCode(target);
|
||||
if (scripts == null
|
||||
|| priority(scripts[0]) < priority(sourceScript)) {
|
||||
|
@ -81,9 +81,9 @@ public class WriteCharts {
|
|||
continue;
|
||||
}
|
||||
System.out.println("\tTarget: " + target + ";\tScripts: " + showScripts(scripts));
|
||||
Enumeration variants = Transliterator.getAvailableVariants(source, target);
|
||||
Enumeration<String> variants = Transliterator.getAvailableVariants(source, target);
|
||||
while(variants.hasMoreElements()) {
|
||||
String variant = (String) variants.nextElement();
|
||||
String variant = variants.nextElement();
|
||||
String id = source + "-" + target;
|
||||
if (variant.length() != 0) {
|
||||
id += "/" + variant;
|
||||
|
@ -167,7 +167,7 @@ public class WriteCharts {
|
|||
UnicodeSet leftOverSet = new UnicodeSet(targetSet);
|
||||
UnicodeSet privateUse = new UnicodeSet("[:private use:]");
|
||||
|
||||
Map map = new TreeMap();
|
||||
Map<String, String> map = new TreeMap<>();
|
||||
|
||||
UnicodeSet targetSetPlusAnyways = new UnicodeSet(targetSet);
|
||||
targetSetPlusAnyways.addAll(okAnyway);
|
||||
|
@ -315,7 +315,7 @@ public class WriteCharts {
|
|||
out.println("<h2>Round Trip</h2>");
|
||||
out.println(tableHeader);
|
||||
|
||||
Iterator it = map.keySet().iterator();
|
||||
Iterator<String> it = map.keySet().iterator();
|
||||
char lastGroup = 0;
|
||||
int count = 0;
|
||||
int column = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue