From 27df92a84a3a65f64373e399015262992cfa54a6 Mon Sep 17 00:00:00 2001 From: Brian Dahlem Date: Wed, 3 Sep 2025 15:47:18 -0700 Subject: [PATCH 1/2] feat: update project to Java 17 --- dependency-reduced-pom.xml | 50 +++---------------- nb-configuration.xml | 6 +-- pom.xml | 47 ++++------------- .../run/myCode/compiler/JavaCodeCompiler.java | 6 +-- .../java/zss/compiler/MemoryCompiler.java | 2 +- 5 files changed, 26 insertions(+), 85 deletions(-) diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index 12fc0d0..bc81d14 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -6,30 +6,9 @@ 4.0.0 - - maven-install-plugin - - - hack-binary - clean - - install-file - - - ${JAVA_HOME}/lib/tools.jar - default - com.sun - tools - jdk1.8.0 - jar - true - - - - - - maven-shade-plugin - 3.0.0 + + maven-shade-plugin + 3.0.0 package @@ -44,20 +23,7 @@ - - - windows-profile - - ${JAVA_HOME}/lib/tools.jar - - - - mac-profile - - ${java.home}/../lib/tools.jar - - - + junit @@ -73,8 +39,8 @@ - 1.8 - 1.8 - - + 17 + 17 + + diff --git a/nb-configuration.xml b/nb-configuration.xml index 15dea5e..469d086 100644 --- a/nb-configuration.xml +++ b/nb-configuration.xml @@ -13,6 +13,6 @@ You can copy and paste the single properties, into the pom.xml file and the IDE That way multiple projects can share the same settings (useful for formatting rules for example). Any value defined here will override the pom.xml file value but is only applicable to the current project. --> - JDK_1.8 - - + JDK_17 + + diff --git a/pom.xml b/pom.xml index aef3cf6..e1694cc 100644 --- a/pom.xml +++ b/pom.xml @@ -4,10 +4,11 @@ hellofunction 6.0.1 - 1.8 - 1.8 - UTF-8 - + 17 + 17 + 17 + UTF-8 + cagatay-gurturk @@ -19,32 +20,7 @@ https://repo.eclipse.org/content/repositories/eclipse-staging/ --> - - - windows-profile - - true - - ${JAVA_HOME}/lib/tools.jar - - - - ${JAVA_HOME}/lib/tools.jar - - - - mac-profile - - false - - ${java.home}/../lib/tools.jar - - - - ${java.home}/../lib/tools.jar - - - + @@ -93,12 +69,11 @@ --> - - org.eclipse.jdt - ecj - (,3.13.0] - - + + org.eclipse.jdt + ecj + 3.42.0 + junit diff --git a/src/main/java/run/myCode/compiler/JavaCodeCompiler.java b/src/main/java/run/myCode/compiler/JavaCodeCompiler.java index 861d0d1..46a256d 100644 --- a/src/main/java/run/myCode/compiler/JavaCodeCompiler.java +++ b/src/main/java/run/myCode/compiler/JavaCodeCompiler.java @@ -95,9 +95,9 @@ public static FromMemoryClassLoader compile(Iterable f // System.out.println(">> " + classpath + " <<"); // Set the classpath and java version for the compiler - options.addAll(Arrays.asList("-classpath", - classpath)); - options.addAll(Arrays.asList("-1.8")); + options.addAll(Arrays.asList("-classpath", + classpath)); + options.addAll(Arrays.asList("-17")); Writer out = new PrintWriter(System.out); diff --git a/src/main/java/zss/compiler/MemoryCompiler.java b/src/main/java/zss/compiler/MemoryCompiler.java index 45ab749..25a0084 100644 --- a/src/main/java/zss/compiler/MemoryCompiler.java +++ b/src/main/java/zss/compiler/MemoryCompiler.java @@ -51,7 +51,7 @@ public static FromMemoryClassLoader compile(Iterable f options.addAll( Arrays.asList("-classpath", MemoryCompiler.class.getProtectionDomain().getCodeSource().getLocation() + ":" + System.getProperty("java.class.path"))); - options.addAll(Arrays.asList("-1.8", "-nowarn")); + options.addAll(Arrays.asList("-17", "-nowarn")); Writer out = new PrintWriter(System.out); JavaCompiler.CompilationTask task = compiler.getTask(out, fileManager, diag, options, null, files); From dc79544a0eb3fed8232e21d390b99841c5ed601a Mon Sep 17 00:00:00 2001 From: Brian Dahlem Date: Wed, 3 Sep 2025 15:56:02 -0700 Subject: [PATCH 2/2] chore: configure Java 17 in devcontainer and CI --- .devcontainer/devcontainer.json | 6 ++++++ .github/workflows/codeql-analysis.yml | 6 ++++++ .github/workflows/maven-publish.yml | 7 ++++--- .github/workflows/maven.yml | 7 ++++--- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..873a882 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,6 @@ +{ + "name": "Java 17 Dev Container", + "image": "mcr.microsoft.com/devcontainers/java:17", + "settings": {}, + "extensions": [] +} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e935a91..ab20f69 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,6 +37,12 @@ jobs: - name: Checkout repository uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v1 diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 5de62b4..37e2eb5 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -14,10 +14,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 1.8 + distribution: 'temurin' + java-version: '17' server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c8aeb3a..ae9ed8c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -16,9 +16,10 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - java-version: 1.8 + distribution: 'temurin' + java-version: '17' - name: Build with Maven run: mvn -B package --file pom.xml