From 6c1c53f02cc47a5f99ee6f8bc5c7e7466211a31d Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 8 Mar 2024 10:08:14 +0700 Subject: [PATCH 1/2] Recognize JDK 22 class format --- .../extraenforcer/dependencies/EnforceBytecodeVersion.java | 3 +++ .../extraenforcer/dependencies/EnforceBytecodeVersionTest.java | 1 + 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java b/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java index 0193d7b..ec7f0d1 100644 --- a/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java +++ b/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java @@ -129,6 +129,9 @@ public class EnforceBytecodeVersion extends AbstractResolveDependencies { // Java 21 JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("21", 65); + + // Java 22 + JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("22", 66); } @Inject diff --git a/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java b/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java index 7fa6bd1..f418167 100644 --- a/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java +++ b/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java @@ -31,5 +31,6 @@ public void renderVersion() { assertEquals("51.3", EnforceBytecodeVersion.renderVersion(51, 3)); assertEquals("44.0", EnforceBytecodeVersion.renderVersion(44, 0)); assertEquals("JDK 21", EnforceBytecodeVersion.renderVersion(65, 0)); + assertEquals("JDK 22", EnforceBytecodeVersion.renderVersion(66, 0)); } } From ea0458dedb8f064c5d41d613dd9eb4f83bc5dbfb Mon Sep 17 00:00:00 2001 From: "Mateusz \"Serafin\" Gajewski" Date: Fri, 8 Mar 2024 10:08:53 +0700 Subject: [PATCH 2/2] Recognize JDK 23 class format --- .../extraenforcer/dependencies/EnforceBytecodeVersion.java | 3 +++ .../extraenforcer/dependencies/EnforceBytecodeVersionTest.java | 1 + 2 files changed, 4 insertions(+) diff --git a/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java b/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java index ec7f0d1..251152a 100644 --- a/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java +++ b/src/main/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersion.java @@ -132,6 +132,9 @@ public class EnforceBytecodeVersion extends AbstractResolveDependencies { // Java 22 JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("22", 66); + + // Java 23 + JDK_TO_MAJOR_VERSION_NUMBER_MAPPING.put("23", 67); } @Inject diff --git a/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java b/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java index f418167..bc1056c 100644 --- a/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java +++ b/src/test/java/org/codehaus/mojo/extraenforcer/dependencies/EnforceBytecodeVersionTest.java @@ -32,5 +32,6 @@ public void renderVersion() { assertEquals("44.0", EnforceBytecodeVersion.renderVersion(44, 0)); assertEquals("JDK 21", EnforceBytecodeVersion.renderVersion(65, 0)); assertEquals("JDK 22", EnforceBytecodeVersion.renderVersion(66, 0)); + assertEquals("JDK 23", EnforceBytecodeVersion.renderVersion(67, 0)); } }