Skip to content

Commit

Permalink
Make build and run tests with Java 18/19 possible
Browse files Browse the repository at this point in the history
  • Loading branch information
slachiewicz committed Jun 19, 2022
1 parent 210743c commit c97da65
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 15 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@ jobs:
uses: codehaus-plexus/.github/.github/workflows/maven.yml@master
with:
jdk-fast-fail-build: '11'
jdk-matrix: '["11", "17"]'
jdk-distribution-matrix: '["zulu", "temurin", "microsoft", "liberica"]'
jdk-matrix: '["11", "17", "18", "19-ea"]'
jdk-distribution-matrix: '["zulu", "temurin", "microsoft", "liberica","corretto"]'
os-matrix: '["ubuntu-latest","windows-latest", "macOS-latest"]'
matrix-exclude: '[
{ "jdk": "18", "distribution": "microsoft" },
{ "jdk": "19-ea", "distribution": "corretto" },
{ "jdk": "19-ea", "distribution": "liberica" },
{ "jdk": "19-ea", "distribution": "microsoft" },
{ "jdk": "19-ea", "distribution": "temurin" }
]'
maven_args: 'install javadoc:javadoc -e -B -V -fae -Pno-tests-if-not-on-osx'

19 changes: 19 additions & 0 deletions plexus-compiler-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,25 @@
</configuration>
</execution>
</executions>
<dependencies>
<!-- required for Java 19+ (ASM 9.3) -->
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy</artifactId>
<version>3.0.11</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-json</artifactId>
<version>3.0.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-xml</artifactId>
<version>3.0.11</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,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")){
// lots of new warnings about obsoletions for future releases
javaVersion.contains("15")||javaVersion.contains("16")||javaVersion.contains("17")||
javaVersion.contains("18")||javaVersion.contains("19")){
return 5;
}
// javac output changed for misspelled modifiers starting in 1.6...they now generate 2 errors per occurrence, not one.
Expand All @@ -88,14 +88,10 @@ 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("15")||javaVersion.contains("16")||javaVersion.contains("17")||
javaVersion.contains("18")||javaVersion.contains("19")){
return 1;
}
if (javaVersion.contains("9.0")){
// lots of new warnings about obsoletions for future releases
return 8;
}

if (javaVersion.contains("1.8")){
// lots of new warnings about obsoletions for future releases
return 30;
Expand Down Expand Up @@ -132,6 +128,12 @@ public String getTargetVersion()
if (javaVersion.contains("17")){
return "17";
}
if (javaVersion.contains("18")){
return "18";
}
if (javaVersion.contains("19")){
return "19";
}
return super.getTargetVersion();
}

Expand Down Expand Up @@ -161,6 +163,12 @@ public String getSourceVersion()
if (javaVersion.contains("17")){
return "17";
}
if (javaVersion.contains("18")){
return "18";
}
if (javaVersion.contains("19")){
return "19";
}
return super.getTargetVersion();
}

Expand All @@ -169,12 +177,14 @@ 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")){
return Arrays.asList( new String[]{ "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",
"org/codehaus/foo/Person.class"} );
javaVersion.contains("15")||javaVersion.contains("16")||javaVersion.contains("17")||
javaVersion.contains("18")||javaVersion.contains("19")
){
return Arrays.asList( "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",
"org/codehaus/foo/Person.class" );
}
return Arrays.asList( new String[]{ "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",
"org/codehaus/foo/Person.class", "org/codehaus/foo/ReservedWord.class" } );
return Arrays.asList( "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",
"org/codehaus/foo/Person.class", "org/codehaus/foo/ReservedWord.class" );
}

protected void internalTest(CompilerConfiguration compilerConfiguration, List<String> expectedArguments) {
Expand Down

0 comments on commit c97da65

Please sign in to comment.