From 6c633eb7257cfb24e480e13249ce2afd80f8d7b7 Mon Sep 17 00:00:00 2001
From: Julien Dubois <julien.dubois@gmail.com>
Date: Fri, 22 Sep 2023 15:02:15 +0200
Subject: [PATCH 1/3] Allow Oracle JDK 21 usage

---
 src/distributions/oracle/installer.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/distributions/oracle/installer.ts b/src/distributions/oracle/installer.ts
index ec0ab21..72a92fb 100644
--- a/src/distributions/oracle/installer.ts
+++ b/src/distributions/oracle/installer.ts
@@ -88,8 +88,8 @@ export class OracleDistribution extends JavaBase {
       `${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`
     );
 
-    if (parseInt(major) < 17) {
-      throw new Error('Oracle JDK is only supported for JDK 17 and later');
+    if (parseInt(major) < 21) {
+      throw new Error('Oracle JDK is only supported for JDK 21 and later');
     }
 
     for (const url of possibleUrls) {

From 7206b0eb430145738744af032ebe43d66e863461 Mon Sep 17 00:00:00 2001
From: Julien Dubois <julien.dubois@gmail.com>
Date: Fri, 22 Sep 2023 16:21:08 +0200
Subject: [PATCH 2/3] Fix tests

---
 __tests__/distributors/oracle-installer.test.ts | 5 +++++
 docs/advanced-usage.md                          | 2 +-
 src/distributions/oracle/installer.ts           | 4 ++--
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/__tests__/distributors/oracle-installer.test.ts b/__tests__/distributors/oracle-installer.test.ts
index ad16eca..356c0c6 100644
--- a/__tests__/distributors/oracle-installer.test.ts
+++ b/__tests__/distributors/oracle-installer.test.ts
@@ -22,6 +22,11 @@ describe('findPackageForDownload', () => {
   });
 
   it.each([
+    [
+      '21',
+      '21',
+      'https://download.oracle.com/java/21/latest/jdk-21_{{OS_TYPE}}-x64_bin.{{ARCHIVE_TYPE}}'
+    ],
     [
       '20',
       '20',
diff --git a/docs/advanced-usage.md b/docs/advanced-usage.md
index e13366d..48aecfd 100644
--- a/docs/advanced-usage.md
+++ b/docs/advanced-usage.md
@@ -121,7 +121,7 @@ steps:
 - uses: actions/setup-java@v3
   with:
     distribution: 'oracle'
-    java-version: '17'
+    java-version: '21'
 - run: java -cp java HelloWorldApp
 ```
 
diff --git a/src/distributions/oracle/installer.ts b/src/distributions/oracle/installer.ts
index 72a92fb..ec0ab21 100644
--- a/src/distributions/oracle/installer.ts
+++ b/src/distributions/oracle/installer.ts
@@ -88,8 +88,8 @@ export class OracleDistribution extends JavaBase {
       `${ORACLE_DL_BASE}/${major}/archive/jdk-${range}_${platform}-${arch}_bin.${extension}`
     );
 
-    if (parseInt(major) < 21) {
-      throw new Error('Oracle JDK is only supported for JDK 21 and later');
+    if (parseInt(major) < 17) {
+      throw new Error('Oracle JDK is only supported for JDK 17 and later');
     }
 
     for (const url of possibleUrls) {

From 447ed6f2d004479a06fe15c6706be5b43b0ccf4c Mon Sep 17 00:00:00 2001
From: Julien Dubois <julien.dubois@gmail.com>
Date: Fri, 22 Sep 2023 16:26:54 +0200
Subject: [PATCH 3/3] Add Java 21 support in the documentation

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index a5512c6..27f5b22 100644
--- a/README.md
+++ b/README.md
@@ -88,7 +88,7 @@ steps:
 
 #### Supported version syntax
 The `java-version` input supports an exact version or a version range using [SemVer](https://semver.org/) notation:
-- major versions: `8`, `11`, `16`, `17`
+- major versions: `8`, `11`, `16`, `17`, `21`
 - more specific versions: `17.0`, `11.0`, `11.0.4`, `8.0.232`, `8.0.282+8`
 - early access (EA) versions: `15-ea`, `15.0.0-ea`, `15.0.0-ea.2`, `15.0.0+2-ea`