Skip to content

Commit

Permalink
Support jdk 21 (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Oct 26, 2023
1 parent 2804681 commit e7dc731
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,9 @@ jobs:
name: Build it
uses: codehaus-plexus/.github/.github/workflows/maven.yml@master
with:
jdk-fast-fail-build: '11'
jdk-matrix: '["11", "17", "20"]'
jdk-distribution-matrix: '["zulu", "temurin", "microsoft", "liberica","corretto"]'
jdk-fast-fail-build: '21'
jdk-matrix: '["11", "17", "21"]'
jdk-distribution-matrix: '["zulu", "temurin", "microsoft", "liberica", "corretto"]'
os-matrix: '["ubuntu-latest","windows-latest", "macOS-latest"]'
matrix-exclude: '[
{ "jdk": "21-ea", "distribution": "corretto" },
{ "jdk": "21-ea", "distribution": "liberica" },
{ "jdk": "20", "distribution": "microsoft" },
{ "jdk": "21-ea", "distribution": "temurin" }
]'
maven_args: 'install javadoc:javadoc -e -B -V -fae -Pno-tests-if-not-on-osx'

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,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")) {
return 5;
}
return 2;
} else if (javaVersion.contains("18") || javaVersion.contains("19") || javaVersion.contains("20")) {
return 5;
} else if (javaVersion.contains("21")) {
return 6;
}
return 2;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ protected int expectedErrors()
String javaVersion = getJavaVersion();
if (javaVersion.contains("9.0")||javaVersion.contains("11")||javaVersion.contains("14")||
javaVersion.contains("15")||javaVersion.contains("16")||javaVersion.contains("17")||
javaVersion.contains("18")||javaVersion.contains("19")||javaVersion.contains("20")){
javaVersion.contains("18")||javaVersion.contains("19")||javaVersion.contains("20")||
javaVersion.contains("21")){
return 5;
}
// javac output changed for misspelled modifiers starting in 1.6...they now generate 2 errors per occurrence, not one.
Expand All @@ -89,7 +90,8 @@ protected int expectedWarnings()
String javaVersion = getJavaVersion();
if (javaVersion.contains("9.0")||javaVersion.contains("11")||javaVersion.contains("14")||
javaVersion.contains("15")||javaVersion.contains("16")||javaVersion.contains("17")||
javaVersion.contains("18")||javaVersion.contains("19")||javaVersion.contains("20")){
javaVersion.contains("18")||javaVersion.contains("19")||javaVersion.contains("20")||
javaVersion.contains("21")){
return 1;
}
if (javaVersion.contains("1.8")){
Expand Down Expand Up @@ -137,6 +139,9 @@ public String getTargetVersion()
if (javaVersion.contains("20")){
return "20";
}
if (javaVersion.contains("21")){
return "21";
}
return super.getTargetVersion();
}

Expand Down Expand Up @@ -175,6 +180,9 @@ public String getSourceVersion()
if (javaVersion.contains("20")){
return "20";
}
if (javaVersion.contains("21")){
return "21";
}
return super.getTargetVersion();
}

Expand All @@ -184,7 +192,8 @@ protected Collection<String> expectedOutputFiles()
String javaVersion = getJavaVersion();
if (javaVersion.contains("9.0")||javaVersion.contains("11")||javaVersion.contains("14")||
javaVersion.contains("15")||javaVersion.contains("16")||javaVersion.contains("17")||
javaVersion.contains("18")||javaVersion.contains("19")||javaVersion.contains("20")
javaVersion.contains("18")||javaVersion.contains("19")||javaVersion.contains("20")||
javaVersion.contains("21")
){
return Arrays.asList( "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",
"org/codehaus/foo/Person.class" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,15 @@ public class JavaxToolsCompilerTest
extends AbstractJavacCompilerTest
{
// no op default is to javax.tools if available

@Override
protected int expectedWarnings() {
String javaVersion = getJavaVersion();
if (javaVersion.contains("21")) {
return 8;
} else {
return super.expectedWarnings();
}
}

}

0 comments on commit e7dc731

Please sign in to comment.