Repository: iluwatar/java-design-patterns
Issue: Build with JDK 17
Labels: info: good first issue
epic: build issue
type: feature

This task is part of the transition plan at https://github.com/iluwatar/java-design-patterns/wiki/19.-Java-17-transition. Here we address the issues that come up when building the project with JDK 17 using language level Java 11.

Acceptance criteria

- Build the project with JDK 17 while keeping the maven-compiler-plugin language level at 11
- Fix the errors that come up during the build


Issue comments:
@iluwatar ,
Can I work on this
Yes, go ahead @harikesh409 
Is this already fixed in master branch? I've built the current state against JDK17 and have no errors.
For me, it fails during naked objects integration tests
@iluwatar Could I work on this?
@harikesh409 I'll assign @robertvolkmann to this issue as well. This is high priority and would like to see it completed soon.

Pull request review comments:

Patch that resolved the issue:
diff --git a/.circleci/config.yml b/.circleci/config.yml
index dad7997a8699..714bd108889a 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -26,14 +26,14 @@ version: 2
 jobs:
   sonar-pr:
     docker:
-      - image: cimg/openjdk:11.0-node
+      - image: cimg/openjdk:17.0-node
     steps:
     - checkout
     - restore_cache:
         key: jdp-sonar-pr-{{ checksum "pom.xml" }}
     - run: |
         sudo apt-get update
-        sudo apt-get install -y openjdk-11-jdk xvfb
+        sudo apt-get install -y openjdk-17-jdk xvfb
         if [ -n "${CIRCLE_PR_NUMBER}" ]; then
           MAVEN_OPTS="-Xmx3000m" xvfb-run ./mvnw -B clean verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar \
              -Dsonar.pullrequest.key=${CIRCLE_PR_NUMBER} \
diff --git a/.github/workflows/maven-ci.yml b/.github/workflows/maven-ci.yml
index 1f490cf31be8..f9d8b063dd9c 100644
--- a/.github/workflows/maven-ci.yml
+++ b/.github/workflows/maven-ci.yml
@@ -39,7 +39,7 @@ jobs:
   # This Workflow Job will build this project and run Sonar analysis using JDK 11.0.3
   build-and-analyze:
 
-    name: Build and Run Sonar analysis on JDK 11.0.3
+    name: Build and Run Sonar analysis on JDK 17
     runs-on: ubuntu-20.04
     steps:
 
@@ -49,11 +49,11 @@ jobs:
         # Disabling shallow clone for improving relevancy of SonarQube reporting
         fetch-depth: 0
 
-    - name: Set up JDK 11.0.3
+    - name: Set up JDK 17
       uses: actions/setup-java@v3
       with:
-        java-version: 11.0.3
-        distribution: 'zulu'
+        java-version: '17'
+        distribution: 'temurin'
         cache: 'maven'
 
     # Cache Sonar packages which as used to run anaylysis and collect metrics
@@ -79,18 +79,18 @@ jobs:
   # This Workflow Job is going to build the project on the latest stable JDK 11
   build:
 
-    name: Build and Test on JDK 11
+    name: Build and Test on JDK 17
     runs-on: ubuntu-20.04
     steps:
 
     - name: Checkout Code
       uses: actions/checkout@v3
 
-    - name: Set up JDK 11 (Latest)
+    - name: Set up JDK 17
       uses: actions/setup-java@v3
       with:
-        java-version: 11
-        distribution: 'zulu'
+        java-version: '17'
+        distribution: 'temurin'
         cache: 'maven'
 
     # Some tests need screen access
diff --git a/.github/workflows/maven-pr-builder.yml b/.github/workflows/maven-pr-builder.yml
index 66d39d40df7a..62664d614ea0 100644
--- a/.github/workflows/maven-pr-builder.yml
+++ b/.github/workflows/maven-pr-builder.yml
@@ -34,21 +34,18 @@ on:
 jobs:
   build:
 
-    name: Build JDP
+    name: Build on JDK 17
     runs-on: ubuntu-20.04
-    strategy:
-      matrix:
-        java-version: [ 11.0.3, 11 ]
     steps:
     
     - name: Checkout Code
       uses: actions/checkout@v3
     
-    - name: Set up JDK ${{ matrix.java-version }}
+    - name: Set up JDK 17
       uses: actions/setup-java@v3
       with:
-        java-version: ${{ matrix.java-version }}
-        distribution: 'zulu'
+        java-version: '17'
+        distribution: 'temurin'
         cache: 'maven'
     
     # Some tests need screen access


Test patch: