Skip to content

Commit 20c7949

Browse files
Copilotslachiewicz
andcommitted
Migrate from Java 22 to Java 24 to avoid preview API issues
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
1 parent 6513abb commit 20c7949

File tree

6 files changed

+14
-50
lines changed

6 files changed

+14
-50
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ Plexus Java:
1717
Plexus Java uses a multi-release JAR to provide optimal module-info parsing for different Java versions:
1818

1919
- **Java 8**: ASM-based parser for module-info.class files
20-
- **Java 9-21**: Native `java.lang.module.ModuleDescriptor` API
21-
- **Java 22+**: Java Class File API (JEP 457/466/484)
20+
- **Java 9-23**: Native `java.lang.module.ModuleDescriptor` API
21+
- **Java 24+**: Java Class File API (JEP 484)
2222

2323
The appropriate implementation is automatically selected based on the runtime JVM version.
2424

plexus-java/pom.xml

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -128,40 +128,6 @@
128128
</pluginManagement>
129129
</build>
130130
</profile>
131-
<profile>
132-
<id>jdk22</id>
133-
<activation>
134-
<jdk>[22,24)</jdk>
135-
</activation>
136-
<build>
137-
<pluginManagement>
138-
<plugins>
139-
<plugin>
140-
<groupId>org.apache.maven.plugins</groupId>
141-
<artifactId>maven-compiler-plugin</artifactId>
142-
<executions>
143-
<execution>
144-
<id>jdk22</id>
145-
<goals>
146-
<goal>compile</goal>
147-
</goals>
148-
<configuration>
149-
<release>22</release>
150-
<multiReleaseOutput>true</multiReleaseOutput>
151-
<compileSourceRoots>
152-
<compileSourceRoot>${project.basedir}/src/main/java22</compileSourceRoot>
153-
</compileSourceRoots>
154-
<compilerArgs>
155-
<arg>--enable-preview</arg>
156-
</compilerArgs>
157-
</configuration>
158-
</execution>
159-
</executions>
160-
</plugin>
161-
</plugins>
162-
</pluginManagement>
163-
</build>
164-
</profile>
165131
<profile>
166132
<id>jdk24</id>
167133
<activation>
@@ -180,10 +146,10 @@
180146
<goal>compile</goal>
181147
</goals>
182148
<configuration>
183-
<release>22</release>
149+
<release>24</release>
184150
<multiReleaseOutput>true</multiReleaseOutput>
185151
<compileSourceRoots>
186-
<compileSourceRoot>${project.basedir}/src/main/java22</compileSourceRoot>
152+
<compileSourceRoot>${project.basedir}/src/main/java24</compileSourceRoot>
187153
</compileSourceRoots>
188154
</configuration>
189155
</execution>
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Java 22+ Class File API Implementation
1+
# Java 24+ Class File API Implementation
22

3-
This directory contains an implementation of the module-info parser using the Java Class File API, which was introduced as a preview feature in Java 22 (JEP 457).
3+
This directory contains an implementation of the module-info parser using the Java Class File API, which was finalized in Java 24 (JEP 484).
44

55
## Background
66

77
The Class File API provides a native Java API for parsing and generating class files, eliminating the need for external libraries like ASM for this purpose.
88

99
### Timeline
1010

11-
- **Java 22** (March 2024): Preview feature (JEP 457) - requires `--enable-preview`
12-
- **Java 23** (September 2024): Second Preview (JEP 466) - requires `--enable-preview`
13-
- **Java 24** (March 2025): Expected to be finalized (JEP 484) - no preview flag needed
11+
- **Java 22** (March 2024): Preview feature (JEP 457)
12+
- **Java 23** (September 2024): Second Preview (JEP 466)
13+
- **Java 24** (March 2025): Finalized (JEP 484)
1414

1515
## Implementation
1616

@@ -21,17 +21,15 @@ This implementation uses:
2121

2222
## Building
2323

24-
When building with Java 22 or 23, the `--enable-preview` flag is automatically added by the Maven compiler plugin configuration.
24+
When building with Java 24+, this code is automatically compiled and included in the multi-release JAR.
2525

26-
When building with Java 24+, the preview flag should not be needed as the API should be finalized.
27-
28-
When building with Java 17 or earlier, this code is not compiled, and the Java 9 implementation (using `java.lang.module.ModuleDescriptor`) is used instead.
26+
When building with Java 23 or earlier, this code is not compiled, and the Java 9 implementation (using `java.lang.module.ModuleDescriptor`) is used instead.
2927

3028
## Multi-Release JAR
3129

3230
This implementation is part of a multi-release JAR structure:
3331
- Java 8: Uses ASM-based parser
34-
- Java 9-21: Uses `java.lang.module.ModuleDescriptor`
35-
- Java 22+: Uses Class File API (this implementation)
32+
- Java 9-23: Uses `java.lang.module.ModuleDescriptor`
33+
- Java 24+: Uses Class File API (this implementation)
3634

3735
The appropriate version is automatically selected at runtime based on the JVM version.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
<includes>
6565
<include>src/main/java/**/*.java</include>
6666
<include>src/main/java9/**/*.java</include>
67-
<include>src/main/java22/**/*.java</include>
67+
<include>src/main/java24/**/*.java</include>
6868
<include>src/test/java/**/*.java</include>
6969
</includes>
7070
</java>

0 commit comments

Comments
 (0)