diff --git a/.travis.yml b/.travis.yml index 6158009b..61b199b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ jdk: - oraclejdk8 - oraclejdk9 - - openjdk7 - + - oraclejdk11 + script: "mvn --show-version --errors --batch-mode clean verify -DredirectTestOutputToFile=false" cache: diff --git a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java index 9c1c9d42..50da0b4b 100644 --- a/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java +++ b/plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java @@ -115,9 +115,12 @@ public void testCompilingSources() int numCompilerWarnings = messages.size() - numCompilerErrors; - if ( expectedErrors() != numCompilerErrors ) + int expectedErrors = expectedErrors(); + + if ( expectedErrors != numCompilerErrors ) { System.out.println( numCompilerErrors + " error(s) found:" ); + List errors = new ArrayList<>(); for ( CompilerMessage error : messages ) { if ( !error.isError() ) @@ -129,13 +132,17 @@ public void testCompilingSources() System.out.println( error.getFile() ); System.out.println( error.getMessage() ); System.out.println( "----" ); + errors.add( error.getMessage() ); } - assertEquals( "Wrong number of compilation errors: " + messages, expectedErrors(), numCompilerErrors ); + assertEquals( "Wrong number of compilation errors (" + numCompilerErrors + "/" + expectedErrors // + + ") : " + errors, expectedErrors, numCompilerErrors ); } - if ( expectedWarnings() != numCompilerWarnings ) + int expectedWarnings = expectedWarnings(); + if ( expectedWarnings != numCompilerWarnings ) { + List warnings = new ArrayList<>(); System.out.println( numCompilerWarnings + " warning(s) found:" ); for ( CompilerMessage error : messages ) { @@ -148,9 +155,11 @@ public void testCompilingSources() System.out.println( error.getFile() ); System.out.println( error.getMessage() ); System.out.println( "----" ); + warnings.add( error.getMessage() ); } - assertEquals( "Wrong number of compilation warnings.", expectedWarnings(), numCompilerWarnings ); + assertEquals( "Wrong number (" + numCompilerWarnings + "/" + expectedWarnings + ") of compilation warnings: " + warnings, // + expectedWarnings, numCompilerWarnings ); } assertEquals( new TreeSet<>( normalizePaths( expectedOutputFiles() ) ), files ); @@ -224,7 +233,7 @@ public String getSourceVersion() private List normalizePaths( Collection relativePaths ) { - List normalizedPaths = new ArrayList(); + List normalizedPaths = new ArrayList<>(); for ( String relativePath : relativePaths ) { normalizedPaths.add( relativePath.replace( File.separatorChar, '/' ) ); diff --git a/plexus-compilers/plexus-compiler-aspectj/pom.xml b/plexus-compilers/plexus-compiler-aspectj/pom.xml index cd70f131..61bebce2 100644 --- a/plexus-compilers/plexus-compiler-aspectj/pom.xml +++ b/plexus-compilers/plexus-compiler-aspectj/pom.xml @@ -14,7 +14,7 @@ AspectJ Compiler support for Plexus Compiler component. - 1.8.9 + 1.9.2 diff --git a/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java b/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java index 0371967a..c06e391d 100644 --- a/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java +++ b/plexus-compilers/plexus-compiler-aspectj/src/main/java/org/codehaus/plexus/compiler/ajc/AspectJCompiler.java @@ -503,9 +503,21 @@ private List buildFileList( List locations ) private void setSourceVersion( AjBuildConfig buildConfig, String sourceVersion ) throws CompilerException { - if ( "1.9".equals( sourceVersion ) ) + if ( "11".equals( sourceVersion ) ) { - buildConfig.getOptions().sourceLevel = ClassFileConstants.JDK1_9; + buildConfig.getOptions().sourceLevel = ClassFileConstants.JDK11; + } + else if ( "10".equals( sourceVersion ) ) + { + buildConfig.getOptions().sourceLevel = ClassFileConstants.JDK10; + } + else if ( "9".equals( sourceVersion ) ) + { + buildConfig.getOptions().sourceLevel = ClassFileConstants.JDK9; + } + else if ( "1.9".equals( sourceVersion ) ) + { + buildConfig.getOptions().sourceLevel = ClassFileConstants.JDK9; } else if ( "1.8".equals( sourceVersion ) ) { diff --git a/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java b/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java index b897b563..e3c9835b 100644 --- a/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java +++ b/plexus-compilers/plexus-compiler-aspectj/src/test/java/org/codehaus/plexus/compiler/ajc/AspectJCompilerTest.java @@ -28,7 +28,8 @@ protected int expectedErrors() { // olamy well I agree it's hackhish but I don't want to waste too much time with aspectj which is probably // not used a lot anymore... - if (getJavaVersion().startsWith( "9" ) || getJavaVersion().startsWith( "10" )) + String javaVersion = getJavaVersion(); + if (javaVersion.equals( "11" )) { return 11; } @@ -40,10 +41,10 @@ protected Collection expectedOutputFiles() String javaVersion = System.getProperty( "java.version" ); // olamy well I agree it's hackhish but I don't want to waste too much time with aspectj which is probably // not used a lot anymore... - if (javaVersion.startsWith( "9" ) || javaVersion.startsWith( "10" )) - { - return Collections.emptyList(); - } +// if (javaVersion.startsWith( "9" ) || javaVersion.startsWith( "10" )) +// { +// return Collections.emptyList(); +// } return Arrays.asList( new String[]{ "org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class" } ); } diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index 2e1f1235..ec5f9107 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -21,7 +21,7 @@ org.eclipse.jdt ecj - 3.13.100 + 3.15.1 diff --git a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml index 6f737cee..dbf0b7da 100644 --- a/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml +++ b/plexus-compilers/plexus-compiler-javac-errorprone/pom.xml @@ -29,7 +29,7 @@ com.google.errorprone error_prone_core - 2.2.0 + 2.3.2 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 76359d86..fdee0363 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 @@ -60,14 +60,14 @@ protected String getRoleHint() protected int expectedErrors() { - - if (getJavaVersion().contains("9.0")){ + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0")||javaVersion.contains("11")){ // lots of new warnings about obsoletions for future releases return 5; } // javac output changed for misspelled modifiers starting in 1.6...they now generate 2 errors per occurrence, not one. - if ( "1.5".compareTo( getJavaVersion() ) < 0 ) + if ( "1.5".compareTo( javaVersion ) < 0 ) { return 4; } @@ -79,18 +79,21 @@ protected int expectedErrors() protected int expectedWarnings() { - if (getJavaVersion().contains("9.0")){ + String javaVersion = getJavaVersion(); + if (javaVersion.contains("11")){ + return 1; + } + if (javaVersion.contains("9.0")){ // lots of new warnings about obsoletions for future releases return 8; } - - if (getJavaVersion().contains("1.8")){ + if (javaVersion.contains("1.8")){ // lots of new warnings about obsoletions for future releases return 30; } - if ( "1.6".compareTo( getJavaVersion() ) < 0 ) + if ( "1.6".compareTo( javaVersion ) < 0 ) { // with 1.7 some warning with bootstrap class path not set in conjunction with -source 1.3 return 9; @@ -102,24 +105,33 @@ protected int expectedWarnings() @Override public String getTargetVersion() { - if (getJavaVersion().contains("9.0")){ + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0")){ return "1.7"; } + if (javaVersion.contains("11")){ + return "11"; + } return super.getTargetVersion(); } @Override public String getSourceVersion() { - if (getJavaVersion().contains("9.0")){ + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0")){ return "1.7"; } + if (javaVersion.contains("11")){ + return "11"; + } return super.getTargetVersion(); } protected Collection expectedOutputFiles() { - if (getJavaVersion().contains("9.0")){ + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0")||javaVersion.contains("11")){ return Arrays.asList( new String[]{ "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class"} ); } @@ -142,7 +154,7 @@ public void internalTest( CompilerConfiguration compilerConfiguration, List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -155,7 +167,7 @@ public void testBuildCompilerArgs13() public void testBuildCompilerArgs14() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -168,7 +180,7 @@ public void testBuildCompilerArgs14() public void testBuildCompilerArgs15() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -181,7 +193,7 @@ public void testBuildCompilerArgs15() public void testBuildCompilerArgs18() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -194,7 +206,7 @@ public void testBuildCompilerArgs18() public void testBuildCompilerArgsUnspecifiedVersion() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -205,7 +217,7 @@ public void testBuildCompilerArgsUnspecifiedVersion() public void testBuildCompilerDebugLevel() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -221,7 +233,7 @@ public void testBuildCompilerDebugLevel() // PLXCOMP-190 public void testJRuntimeArguments() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -251,7 +263,7 @@ public void testJRuntimeArguments() public void testModulePath() throws Exception { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -278,7 +290,7 @@ public void testModulePath() throws Exception public void testModuleVersion() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -303,7 +315,7 @@ public void testModuleVersion() public void testReleaseVersion() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -322,7 +334,7 @@ public void testReleaseVersion() public void testFailOnWarning() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); @@ -346,7 +358,7 @@ public void testFailOnWarning() public void testMultipleAddExports() { - List expectedArguments = new ArrayList(); + List expectedArguments = new ArrayList<>(); CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); diff --git a/pom.xml b/pom.xml index fdec2cc2..ea32f0ab 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.20 + 2.22.1 ${redirectTestOutputToFile} @@ -148,6 +148,29 @@ + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M2 + + + enforce-java + + enforce + + + + + [1.8,) + [ERROR] OLD JDK [${java.version}] in use. This projects requires JDK 8 or newer + + + + + + +