Skip to content

Commit 94709f6

Browse files
committed
Pass tests with Java 22 and 23
1 parent 3a8a444 commit 94709f6

File tree

3 files changed

+29
-6
lines changed

3 files changed

+29
-6
lines changed

plexus-compilers/plexus-compiler-javac-errorprone/src/test/java/org/codehaus/plexus/compiler/javac/JavacErrorProneCompilerTest.java

+5-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,12 @@ protected int expectedWarnings() {
1717
String javaVersion = getJavaVersion();
1818
if (javaVersion.startsWith("1.8")) {
1919
return 1;
20-
} else if (javaVersion.contains("18") || javaVersion.contains("19") || javaVersion.contains("20")) {
20+
} else if (javaVersion.contains("18")
21+
|| javaVersion.contains("19")
22+
|| javaVersion.contains("20")
23+
|| javaVersion.contains("23")) {
2124
return 5;
22-
} else if (javaVersion.contains("21")) {
25+
} else if (javaVersion.contains("21") || javaVersion.contains("22")) {
2326
return 6;
2427
}
2528
return 2;

plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java

+21-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ protected int expectedErrors() {
6868
|| javaVersion.contains("18")
6969
|| javaVersion.contains("19")
7070
|| javaVersion.contains("20")
71-
|| javaVersion.contains("21")) {
71+
|| javaVersion.contains("21")
72+
|| javaVersion.contains("22")
73+
|| javaVersion.contains("23")) {
7274
return 5;
7375
}
7476
// javac output changed for misspelled modifiers starting in 1.6...they now generate 2 errors per occurrence,
@@ -92,7 +94,9 @@ protected int expectedWarnings() {
9294
|| javaVersion.contains("18")
9395
|| javaVersion.contains("19")
9496
|| javaVersion.contains("20")
95-
|| javaVersion.contains("21")) {
97+
|| javaVersion.contains("21")
98+
|| javaVersion.contains("22")
99+
|| javaVersion.contains("23")) {
96100
return 1;
97101
}
98102
if (javaVersion.contains("1.8")) {
@@ -141,6 +145,12 @@ public String getTargetVersion() {
141145
if (javaVersion.contains("21")) {
142146
return "21";
143147
}
148+
if (javaVersion.contains("22")) {
149+
return "22";
150+
}
151+
if (javaVersion.contains("23")) {
152+
return "23";
153+
}
144154
return super.getTargetVersion();
145155
}
146156

@@ -177,6 +187,12 @@ public String getSourceVersion() {
177187
if (javaVersion.contains("21")) {
178188
return "21";
179189
}
190+
if (javaVersion.contains("22")) {
191+
return "22";
192+
}
193+
if (javaVersion.contains("23")) {
194+
return "23";
195+
}
180196
return super.getTargetVersion();
181197
}
182198

@@ -192,7 +208,9 @@ protected Collection<String> expectedOutputFiles() {
192208
|| javaVersion.contains("18")
193209
|| javaVersion.contains("19")
194210
|| javaVersion.contains("20")
195-
|| javaVersion.contains("21")) {
211+
|| javaVersion.contains("21")
212+
|| javaVersion.contains("22")
213+
|| javaVersion.contains("23")) {
196214
return Arrays.asList(
197215
"org/codehaus/foo/Deprecation.class",
198216
"org/codehaus/foo/ExternalDeps.class",

plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompilerTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ public class JavaxToolsCompilerTest extends AbstractJavacCompilerTest {
2727
@Override
2828
protected int expectedWarnings() {
2929
String javaVersion = getJavaVersion();
30-
if (javaVersion.contains("21")) {
30+
if (javaVersion.contains("21") || javaVersion.contains("22")) {
3131
return 8;
32+
} else if (javaVersion.contains("23")) {
33+
return 1;
3234
} else {
3335
return super.expectedWarnings();
3436
}

0 commit comments

Comments
 (0)