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

This is part of the transition plan at https://github.com/iluwatar/java-design-patterns/wiki/19.-Java-17-transition. In this issue, we build the project using JDK 11 and try to run it with Java 17 runtime.

Acceptance criteria

- The project is built with JDK 11
- The pattern examples are executed with Java 17 runtime e.g. `java -jar proxy.jar`
- The errors that come up in the testing are fixed


Issue comments:
 I want to help in this issue
   
Ok @ArinCodes 
Can I help in this isssue ..?


I want to help in this issue


@iluwatar Could I work on this?
@ArinCodes I'll assign this issue to @robertvolkmann as well since this is high priority.

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: