Skip to content

Commit

Permalink
Migrate to Java 17
Browse files Browse the repository at this point in the history
  • Loading branch information
egli committed Mar 7, 2024
1 parent ac9eac8 commit a7ad150
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [8, 17]
version: [17, 21]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upload-release-asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update -qq && sudo apt-get install -y libhyphen0 hyphen-de
- name: Set up JDK 8
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '8'
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/junit/junit -->
Expand Down
35 changes: 11 additions & 24 deletions src/main/java/ch/sbs/HyphenationTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,18 @@ public class HyphenationTransformer {
static final QName xml_lang = new QName("http://www.w3.org/XML/1998/namespace",
"lang");

// FIXME: replace new HashMap with Map.of as soon as we move to modern Java
static final Map<String, File> dictionaries = new HashMap<String, File>() {{
put("de", new File("/usr/share/hyphen/hyph_de_DE.dic"));
put("de-CH", new File("/usr/share/hyphen/hyph_de_DE.dic"));
put("de_CH", new File("/usr/share/hyphen/hyph_de_DE.dic"));
put("de-DE", new File("/usr/share/hyphen/hyph_de_DE.dic"));
put("de_DE", new File("/usr/share/hyphen/hyph_de_DE.dic"));
put("de-1901", new File("/usr/share/hyphen/hyph_de_DE_OLDSPELL.dic"));
put("de-CH-1901", new File("/usr/share/hyphen/hyph_de_DE_OLDSPELL.dic"));
put("gsw", new File("/usr/share/hyphen/hyph_de_DE.dic"));
put("en", new File("/usr/share/hyphen/hyph_en_US.dic"));
}};

// static final Map<String, File> dictionaries = Map.of(
// "de", new File("/usr/share/hyphen/hyph_de_DE.dic"),
// "de-CH", new File("/usr/share/hyphen/hyph_de_DE.dic"),
// "de_CH", new File("/usr/share/hyphen/hyph_de_DE.dic"),
// "de-DE", new File("/usr/share/hyphen/hyph_de_DE.dic"),
// "de_DE", new File("/usr/share/hyphen/hyph_de_DE.dic"),
// "de-1901", new File("/usr/share/hyphen/hyph_de_DE_OLDSPELL.dic"),
// "de-CH-1901", new File("/usr/share/hyphen/hyph_de_DE_OLDSPELL.dic"),
// "gsw", new File("/usr/share/hyphen/hyph_de_DE.dic"),
static final Map<String, File> dictionaries = Map.of(
"de", new File("/usr/share/hyphen/hyph_de_DE.dic"),
"de-CH", new File("/usr/share/hyphen/hyph_de_DE.dic"),
"de_CH", new File("/usr/share/hyphen/hyph_de_DE.dic"),
"de-DE", new File("/usr/share/hyphen/hyph_de_DE.dic"),
"de_DE", new File("/usr/share/hyphen/hyph_de_DE.dic"),
"de-1901", new File("/usr/share/hyphen/hyph_de_DE_OLDSPELL.dic"),
"de-CH-1901", new File("/usr/share/hyphen/hyph_de_DE_OLDSPELL.dic"),
"gsw", new File("/usr/share/hyphen/hyph_de_DE.dic"),

// "en", new File("/usr/share/hyphen/hyph_en_US.dic")
// );
"en", new File("/usr/share/hyphen/hyph_en_US.dic")
);

static {
Set<QName> tmp = new HashSet<QName>();
Expand Down

0 comments on commit a7ad150

Please sign in to comment.