From c97da6547aa007f2c5ec6624615ec5b263f9d2ff Mon Sep 17 00:00:00 2001 From: Sylwester Lachiewicz Date: Sun, 19 Jun 2022 17:02:17 +0200 Subject: [PATCH] Make build and run tests with Java 18/19 possible --- .github/workflows/maven.yml | 11 ++++-- plexus-compiler-its/pom.xml | 19 ++++++++++ .../javac/AbstractJavacCompilerTest.java | 36 ++++++++++++------- 3 files changed, 51 insertions(+), 15 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 1291a4dc..4089baf9 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -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' diff --git a/plexus-compiler-its/pom.xml b/plexus-compiler-its/pom.xml index 7ff0a316..7a0c1be1 100644 --- a/plexus-compiler-its/pom.xml +++ b/plexus-compiler-its/pom.xml @@ -65,6 +65,25 @@ + + + + org.codehaus.groovy + groovy + 3.0.11 + runtime + + + org.codehaus.groovy + groovy-json + 3.0.11 + + + org.codehaus.groovy + groovy-xml + 3.0.11 + + diff --git a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java index d90ba447..18c61b63 100644 --- a/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java +++ b/plexus-compilers/plexus-compiler-javac/src/test/java/org/codehaus/plexus/compiler/javac/AbstractJavacCompilerTest.java @@ -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. @@ -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; @@ -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(); } @@ -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(); } @@ -169,12 +177,14 @@ protected Collection 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 expectedArguments) {