Skip to content

Commit

Permalink
ICU-22690 Update ICU4J MessageFormatter to the latest spec, LDML 45
Browse files Browse the repository at this point in the history
  • Loading branch information
mihnita authored and markusicu committed Mar 22, 2024
1 parent 13bf3c8 commit 141e820
Show file tree
Hide file tree
Showing 64 changed files with 5,954 additions and 3,571 deletions.
1 change: 1 addition & 0 deletions .cpyskip.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ icu4j/eclipse-build/pdebuild/customTargets.xml
icu4j/main/core/src/test/resources/com/ibm/icu/dev/data/IDNATestInput.txt
icu4j/main/core/src/test/resources/com/ibm/icu/dev/data/unicode/confusablesWholeScript.txt
icu4j/main/core/src/test/resources/com/ibm/icu/dev/data/unicode/UnicodeData.txt
icu4j/main/core/src/test/resources/com/ibm/icu/dev/test/message2/*.json
icu4j/perf-tests/data/conversion/*
icu4j/perf-tests/data/udhr/*
icu4j/perf-tests/data/collation/thesis.txt
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*.dll
*.dylib
*.exp
*.iml
*.lib
*.lnk
*.ncb
Expand Down
6 changes: 6 additions & 0 deletions icu4j/main/common_tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
<version>${junitparams.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ private List<FileHolder> getJarList(URL jarURL) throws IOException {
}

private static final String[][] SKIP_CASES = {
// com.ibm.icu.message2.Mf2DataModel$OrderedMap was very drafty
{"ICU_72.1", "com.ibm.icu.message2.Mf2DataModel$OrderedMap"},
{"ICU_73.1", "com.ibm.icu.message2.Mf2DataModel$OrderedMap"},
{"ICU_74.1", "com.ibm.icu.message2.Mf2DataModel$OrderedMap"},

// ICU 52+ PluralRules/PluralFormat/CurrencyPluralInfo are not
// serialization-compatible with previous versions.
{"ICU_50.1", "com.ibm.icu.text.CurrencyPluralInfo"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import com.ibm.icu.impl.URLHandler;
import com.ibm.icu.math.BigDecimal;
import com.ibm.icu.math.MathContext;
import com.ibm.icu.message2.Mf2DataModel;
import com.ibm.icu.message2.MFParseException;
import com.ibm.icu.util.AnnualTimeZoneRule;
import com.ibm.icu.util.Calendar;
import com.ibm.icu.util.Currency;
Expand Down Expand Up @@ -763,26 +763,13 @@ public Object[] getTestObjects() {
}
}

private static class Mf2DataModelOrderedMapHandler implements Handler {
private static class MFParseExceptionHandler extends ExceptionHandlerBase {
@Override
public Object[] getTestObjects() {
Mf2DataModel.OrderedMap<String, Object> mapWithContent = new Mf2DataModel.OrderedMap<>();
mapWithContent.put("number", 3.1416d);
mapWithContent.put("date", new Date(1664582400000L /* 20221001T000000Z */));
mapWithContent.put("string", "testing");
return new Mf2DataModel.OrderedMap[] {
new Mf2DataModel.OrderedMap(),
mapWithContent
return new MFParseException[] {
new MFParseException("test", 42)
};
}

@Override
public boolean hasSameBehavior(Object a, Object b) {
// OrderedMap extends LinkedHashMap, without adding any functionality, nothing to test.
Mf2DataModel.OrderedMap ra = (Mf2DataModel.OrderedMap)a;
Mf2DataModel.OrderedMap rb = (Mf2DataModel.OrderedMap)b;
return ra.equals(rb);
}
}

private static HashMap map = new HashMap();
Expand Down Expand Up @@ -882,7 +869,7 @@ public boolean hasSameBehavior(Object a, Object b) {
map.put("com.ibm.icu.util.ICUCloneNotSupportedException", new ICUCloneNotSupportedExceptionHandler());
map.put("com.ibm.icu.util.ICUInputTooLongException", new ICUInputTooLongExceptionHandler());

map.put("com.ibm.icu.message2.Mf2DataModel$OrderedMap", new Mf2DataModelOrderedMapHandler());
map.put("com.ibm.icu.message2.MFParseException", new MFParseExceptionHandler());
}

/*
Expand Down
6 changes: 6 additions & 0 deletions icu4j/main/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
<version>${junitparams.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Loading

0 comments on commit 141e820

Please sign in to comment.