Skip to content

Commit

Permalink
Pass tests with Java 22 and 23
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed Aug 5, 2024
1 parent 3a8a444 commit c88a98f
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ protected int expectedWarnings() {
String javaVersion = getJavaVersion();
if (javaVersion.startsWith("1.8")) {
return 1;
} else if (javaVersion.contains("18") || javaVersion.contains("19") || javaVersion.contains("20")) {
} else if (javaVersion.contains("18")
|| javaVersion.contains("19")
|| javaVersion.contains("20")
|| javaVersion.contains("23")) {
return 5;
} else if (javaVersion.contains("21")) {
} else if (javaVersion.contains("21") || javaVersion.contains("22")) {
return 6;
}
return 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ protected int expectedErrors() {
|| javaVersion.contains("18")
|| javaVersion.contains("19")
|| javaVersion.contains("20")
|| javaVersion.contains("21")) {
|| javaVersion.contains("21")
|| javaVersion.contains("22")
|| javaVersion.contains("23")) {
return 5;
}
// javac output changed for misspelled modifiers starting in 1.6...they now generate 2 errors per occurrence,
Expand All @@ -92,7 +94,9 @@ protected int expectedWarnings() {
|| javaVersion.contains("18")
|| javaVersion.contains("19")
|| javaVersion.contains("20")
|| javaVersion.contains("21")) {
|| javaVersion.contains("21")
|| javaVersion.contains("22")
|| javaVersion.contains("23")) {
return 1;
}
if (javaVersion.contains("1.8")) {
Expand Down Expand Up @@ -141,6 +145,12 @@ public String getTargetVersion() {
if (javaVersion.contains("21")) {
return "21";
}
if (javaVersion.contains("22")) {
return "22";
}
if (javaVersion.contains("23")) {
return "23";
}
return super.getTargetVersion();
}

Expand Down Expand Up @@ -177,6 +187,12 @@ public String getSourceVersion() {
if (javaVersion.contains("21")) {
return "21";
}
if (javaVersion.contains("22")) {
return "22";
}
if (javaVersion.contains("23")) {
return "23";
}
return super.getTargetVersion();
}

Expand All @@ -192,7 +208,9 @@ protected Collection<String> expectedOutputFiles() {
|| javaVersion.contains("18")
|| javaVersion.contains("19")
|| javaVersion.contains("20")
|| javaVersion.contains("21")) {
|| javaVersion.contains("21")
|| javaVersion.contains("22")
|| javaVersion.contains("23")) {
return Arrays.asList(
"org/codehaus/foo/Deprecation.class",
"org/codehaus/foo/ExternalDeps.class",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ public class JavaxToolsCompilerTest extends AbstractJavacCompilerTest {
@Override
protected int expectedWarnings() {
String javaVersion = getJavaVersion();
if (javaVersion.contains("21")) {
if (javaVersion.contains("21") || javaVersion.contains("22")) {
return 8;
} else if (javaVersion.contains("23")) {
return 1;
} else {
return super.expectedWarnings();
}
Expand Down

0 comments on commit c88a98f

Please sign in to comment.