From 1fd4f056510d708438fc5664c74b487a260bf04a Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Wed, 30 Aug 2023 20:36:51 -0500 Subject: [PATCH] CLDR-16393 spotless --- .../org/unicode/cldr/tool/CldrVersion.java | 8 ++-- .../cldr/util/ElementAttributeInfo.java | 45 ++++++++++--------- .../org/unicode/cldr/unittest/TestBasic.java | 29 ++++++++---- 3 files changed, 51 insertions(+), 31 deletions(-) diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CldrVersion.java b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CldrVersion.java index 3098dcf568f..da1c22c7806 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CldrVersion.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/tool/CldrVersion.java @@ -12,7 +12,6 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; - import org.unicode.cldr.util.CLDRFile; import org.unicode.cldr.util.CLDRPaths; import org.unicode.cldr.util.SupplementalDataInfo; @@ -68,7 +67,9 @@ public enum CldrVersion { v41_0, v42_0, v43_0, - /** @see CLDRFile#GEN_VERSION */ + /** + * @see CLDRFile#GEN_VERSION + */ baseline; private final String baseDirectory; @@ -101,7 +102,8 @@ public static CldrVersion from(VersionInfo versionInfo) { public static CldrVersion from(String versionString) { // treat 'current' as baseline - if (versionString.equals(CLDRFile.GEN_VERSION) || versionString.equals(CLDRFile.GEN_VERSION + ".0")) { + if (versionString.equals(CLDRFile.GEN_VERSION) + || versionString.equals(CLDRFile.GEN_VERSION + ".0")) { return CldrVersion.baseline; } return valueOf( diff --git a/tools/cldr-code/src/main/java/org/unicode/cldr/util/ElementAttributeInfo.java b/tools/cldr-code/src/main/java/org/unicode/cldr/util/ElementAttributeInfo.java index 33706b74299..ada72f63448 100644 --- a/tools/cldr-code/src/main/java/org/unicode/cldr/util/ElementAttributeInfo.java +++ b/tools/cldr-code/src/main/java/org/unicode/cldr/util/ElementAttributeInfo.java @@ -73,36 +73,41 @@ public static final ElementAttributeInfo getInstance(String commonDirectory, Dtd return eai; } - private static void addElementAttributeInfo(Map result, DtdType type, String path) throws IOException { + private static void addElementAttributeInfo( + Map result, DtdType type, String path) + throws IOException { if (!new File(path).canRead()) { - System.err.println("ElementAttributeInfo: Warning: Sample file did not exist: " + path + " for DtdType " + type.name()); + System.err.println( + "ElementAttributeInfo: Warning: Sample file did not exist: " + + path + + " for DtdType " + + type.name()); return; // file doesn't exist. } result.put(type, new ElementAttributeInfo(path, type)); } - private static Map makeElementAttributeInfoMap(String canonicalCommonDirectory) throws IOException { + private static Map makeElementAttributeInfoMap( + String canonicalCommonDirectory) throws IOException { Map result; result = new HashMap<>(); // pick short files that are in repository // Add to this when a DTD is added - addElementAttributeInfo(result, - DtdType.ldml, - canonicalCommonDirectory + "/main/root.xml"); - addElementAttributeInfo(result, - DtdType.supplementalData, - canonicalCommonDirectory + "/supplemental/plurals.xml"); - addElementAttributeInfo(result, - DtdType.ldmlBCP47, - canonicalCommonDirectory + "/bcp47/calendar.xml"); - addElementAttributeInfo(result, - DtdType.keyboard, - canonicalCommonDirectory - + "/../keyboards/3.0/fr-t-k0-azerty.xml"); - addElementAttributeInfo(result, - DtdType.keyboardTest, - canonicalCommonDirectory - + "/../keyboards/test/fr-t-k0-azerty-test.xml"); + addElementAttributeInfo(result, DtdType.ldml, canonicalCommonDirectory + "/main/root.xml"); + addElementAttributeInfo( + result, + DtdType.supplementalData, + canonicalCommonDirectory + "/supplemental/plurals.xml"); + addElementAttributeInfo( + result, DtdType.ldmlBCP47, canonicalCommonDirectory + "/bcp47/calendar.xml"); + addElementAttributeInfo( + result, + DtdType.keyboard, + canonicalCommonDirectory + "/../keyboards/3.0/fr-t-k0-azerty.xml"); + addElementAttributeInfo( + result, + DtdType.keyboardTest, + canonicalCommonDirectory + "/../keyboards/test/fr-t-k0-azerty-test.xml"); return result; } diff --git a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java index ed998c14536..849a4a6cfac 100644 --- a/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java +++ b/tools/cldr-code/src/test/java/org/unicode/cldr/unittest/TestBasic.java @@ -62,8 +62,8 @@ import org.unicode.cldr.util.DtdData.Attribute; import org.unicode.cldr.util.DtdData.Element; import org.unicode.cldr.util.DtdData.ElementType; -import org.unicode.cldr.util.DtdType.DtdStatus; import org.unicode.cldr.util.DtdType; +import org.unicode.cldr.util.DtdType.DtdStatus; import org.unicode.cldr.util.ElementAttributeInfo; import org.unicode.cldr.util.Factory; import org.unicode.cldr.util.InputStreamFactory; @@ -1007,7 +1007,9 @@ static boolean isLikelyEquivalent(String locale1, String locale2) { static final Map likelyData = SUPPLEMENTAL_DATA_INFO.getLikelySubtags(); - private static final EnumSet badLdmlICUVersions = EnumSet.of(CldrVersion.v1_1_1, CldrVersion.v1_2, CldrVersion.v1_4_1, CldrVersion.v1_5_1); + private static final EnumSet badLdmlICUVersions = + EnumSet.of( + CldrVersion.v1_1_1, CldrVersion.v1_2, CldrVersion.v1_4_1, CldrVersion.v1_5_1); public void TestLikelySubtagsComplete() { LanguageTagParser ltp = new LanguageTagParser(); @@ -1232,7 +1234,9 @@ public void TestBasicDTDCompatibility() { // test all DTDs for (DtdType dtd : DtdType.values()) { if (dtd.getStatus() != DtdType.DtdStatus.active) continue; - if (dtd.firstVersion != null && CldrVersion.LAST_RELEASE_VERSION.isOlderThan(CldrVersion.from(dtd.firstVersion))) { + if (dtd.firstVersion != null + && CldrVersion.LAST_RELEASE_VERSION.isOlderThan( + CldrVersion.from(dtd.firstVersion))) { continue; // DTD didn't exist in last release } if (dtd == DtdType.ldmlICU) continue; @@ -1412,7 +1416,8 @@ public void TestDtdCompatibility() { if (type.getStatus() != DtdStatus.active) { continue; // not active } - if (type.firstVersion != null && version.isOlderThan(CldrVersion.from(type.firstVersion))) { + if (type.firstVersion != null + && version.isOlderThan(CldrVersion.from(type.firstVersion))) { continue; // didn't exist at that point } DtdData dtdDataOld; @@ -1437,8 +1442,9 @@ public void TestDtdCompatibility() { continue; } else { errln( - "v" + version - + ": " + "v" + + version + + ": " + e.getClass().getSimpleName() + ", " + e.getMessage()); @@ -1469,8 +1475,15 @@ public void TestDtdCompatibility() { } Element newChild = newElement.getChildNamed(oldChild.getName()); // skip certain items - if (version.isOlderThan(CldrVersion.v1_6_1) && newElement.getName().equals("zone") && oldChild.getName().equals("usesMetazone")) { - if (logKnownIssue("CLDR-17054", "Breakage with items older than 1.6.1: " + newElement.getName() + " / " + oldChild.getName())) { + if (version.isOlderThan(CldrVersion.v1_6_1) + && newElement.getName().equals("zone") + && oldChild.getName().equals("usesMetazone")) { + if (logKnownIssue( + "CLDR-17054", + "Breakage with items older than 1.6.1: " + + newElement.getName() + + " / " + + oldChild.getName())) { continue; } }