Skip to content

Commit cd299ba

Browse files
karussellSascha Fendrich
authored andcommitted
use jdk17 ga and jdk18 ea (graphhopper#2419)
* use jdk17 ga and jdk18 ea * adoptopenjdk is adoptium and I cannot find ea versions, so use the default ones (sormuras/bach -> install-jdk.properties) * since jdk17 locale IDs changed
1 parent 11a01f0 commit cd299ba

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ env:
1212
matrix:
1313
include:
1414
- jdk: openjdk8
15-
- env: JDK='OpenJDK 16'
16-
install: . ./install-jdk.sh -F 16 -C --url 'https://api.adoptopenjdk.net/v3/binary/latest/16/ga/linux/x64/jdk/hotspot/normal/adoptopenjdk'
1715
- env: JDK='OpenJDK 17'
18-
install: . ./install-jdk.sh -F 17 -C --url 'https://api.adoptopenjdk.net/v3/binary/latest/17/ea/linux/x64/jdk/hotspot/normal/adoptopenjdk'
16+
install: . ./install-jdk.sh -F 17 -C
17+
- env: JDK='OpenJDK 18'
18+
install: . ./install-jdk.sh -F ea -C
1919

2020
# avoid default dependency command for maven, 'true' means 'return true' and continue
2121
install: true

core/src/main/java/com/graphhopper/util/TranslationMap.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,18 @@ public void add(Translation tr) {
8585
if (!locale.getCountry().isEmpty() && !translations.containsKey(tr.getLanguage()))
8686
translations.put(tr.getLanguage(), tr);
8787

88-
// Map old Java 'standard' to latest, Java is a bit ugly here: http://stackoverflow.com/q/13974169/194609
89-
// Hebrew
90-
if ("iw".equals(locale.getLanguage()))
91-
translations.put("he", tr);
92-
93-
// Indonesia
94-
if ("in".equals(locale.getLanguage()))
95-
translations.put("id", tr);
88+
// Hebrew locale was "iw" in old JDKs but is now he
89+
// required in old JDKs:
90+
if ("iw".equals(locale.getLanguage())) translations.put("he", tr);
91+
// required since jdk17 to still provide translation for "iw":
92+
if ("he".equals(locale.getLanguage())) translations.put("iw", tr);
93+
94+
// Indonesia locale was "in_ID" in old JDKs but is now id_ID
95+
// required in old JDKs:
96+
if ("in".equals(locale.getLanguage())) translations.put("id", tr);
97+
// required since jdk17 to still provide translation for "in":
98+
if ("id".equals(locale.getLanguage())) translations.put("in", tr);
99+
// Indian locales are: en-IN and hi-IN and are not overwritten by that
96100
}
97101

98102
/**

core/src/test/java/com/graphhopper/util/TranslationMapTest.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.junit.jupiter.api.Test;
2121

22+
import java.util.Arrays;
2223
import java.util.Locale;
2324

2425
import static org.junit.jupiter.api.Assertions.assertEquals;
@@ -60,8 +61,11 @@ public void testToString() {
6061
assertEquals("רגל", trMap.tr("web.FOOT"));
6162

6263
// Indonesian
63-
assertEquals("in", SINGLETON.get("in").getLanguage());
64-
assertEquals("in", SINGLETON.get("in_ID").getLanguage());
64+
// for jdk17 and later "id" is returned, before "in" was returned
65+
String lang = SINGLETON.get("id").getLanguage();
66+
assertTrue(Arrays.asList("id", "in").contains(lang));
67+
assertEquals(lang, SINGLETON.get("in").getLanguage());
68+
assertEquals(lang, SINGLETON.get("in_ID").getLanguage());
6569

6670
// Vietnamese
6771
assertEquals("vi", SINGLETON.get("vi").getLanguage());

0 commit comments

Comments
 (0)