Skip to content

Commit

Permalink
Upgrade com.ibm.icu:icu4j to latest (69.1) to avoid potential vulnera…
Browse files Browse the repository at this point in the history
…bilities it brings

Also change the template to suite this upgrade, as this upgrade makes the java class larger than jvm can accept.
  • Loading branch information
XenoAmess committed Oct 15, 2021
1 parent 23f93e0 commit d730364
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 10 deletions.
1 change: 1 addition & 0 deletions contributors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,4 @@ YYYY/MM/DD, github id, Full name, email
2021/08/08, ansiemens, Yi-Hong Lin, ansiemens@gmail.com
2021/09/08, jmcken8, Joel McKenzie, joel.b.mckenzie@gmail.com
2021/10/10, tools4origins, Erwan Guyomarc'h, contact@erwan-guyomarch.fr
2021/08/25, XenoAmess, Jin Xu, xenoamess@gmail.com
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ else if ( s instanceof BlockStartState ) {
List<IntervalSet> bmpSets = new ArrayList<>();
List<IntervalSet> smpSets = new ArrayList<>();
for (IntervalSet set : sets.keySet()) {
if (set.getMaxElement() <= Character.MAX_VALUE) {
if (!set.isNil() && set.getMaxElement() <= Character.MAX_VALUE) {
bmpSets.add(set);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion tool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>61.1</version>
<version>69.1</version>
</dependency>
</dependencies>
<build>
Expand Down
38 changes: 30 additions & 8 deletions tool/resources/org/antlr/v4/tool/templates/unicodedata.st
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,40 @@ public abstract class UnicodeData {
// initialization into one method per Unicode property

<propertyCodePointRanges.keys:{ k | // Unicode code points with property "<k>"
static private class PropertyAdder<i> {
static private void addProperty<i>() {
List\<Interval\> intervals = Arrays.asList(
<propertyCodePointRanges.(k).intervals:{ interval | Interval.of(<interval.a>, <interval.b>)}; separator=",\n">
);
IntervalSet codePointRanges = new IntervalSet(intervals);
codePointRanges.setReadonly(true);
propertyCodePointRanges.put("<k>".toLowerCase(Locale.US), codePointRanges);
\}
\}

static private void addProperty<i>() {
List\<Interval\> intervals = Arrays.asList(
<propertyCodePointRanges.(k).intervals:{ interval | Interval.of(<interval.a>, <interval.b>)}; separator=",\n">
);
IntervalSet codePointRanges = new IntervalSet(intervals);
codePointRanges.setReadonly(true);
propertyCodePointRanges.put("<k>".toLowerCase(Locale.US), codePointRanges);
\}}; separator="\n\n">
PropertyAdder<i>.addProperty<i>();
\}

}; separator="\n\n">

static private class PropertyAliasesAdder {
<propertyAliases.keys:{ k |
// Property aliases <i>
static private void addPropertyAliases<i>() {
propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliases.(k)>".toLowerCase(Locale.US));
\}
}; separator="\n">

// Property aliases all
static private void addPropertyAliasesAll() {
<propertyAliases.keys:{ k | PropertyAliasesAdder.addPropertyAliases<i>();}; separator="\n">
}
}

// Property aliases
static private void addPropertyAliases() {
<propertyAliases.keys:{ k | propertyAliases.put("<k>".toLowerCase(Locale.US), "<propertyAliases.(k)>".toLowerCase(Locale.US)); }; separator="\n">
PropertyAliasesAdder.addPropertyAliasesAll();
}

// Put it all together
Expand Down

0 comments on commit d730364

Please sign in to comment.