diff --git a/plexus-compilers/plexus-compiler-eclipse/pom.xml b/plexus-compilers/plexus-compiler-eclipse/pom.xml index e2d1d344..90e32eff 100644 --- a/plexus-compilers/plexus-compiler-eclipse/pom.xml +++ b/plexus-compilers/plexus-compiler-eclipse/pom.xml @@ -25,7 +25,7 @@ org.eclipse.jdt ecj - 3.38.0 + 3.40.0 javax.inject diff --git a/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java b/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java index f14db674..3c7f4f4c 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/main/java/org/codehaus/plexus/compiler/eclipse/EclipseJavaCompiler.java @@ -234,11 +234,11 @@ public CompilerResult performCompile(CompilerConfiguration config) throws Compil getLog().debug("Using JSR-199 EclipseCompiler"); // ECJ JSR-199 compiles against the latest Java version it supports if no source // version is given explicitly. BatchCompiler uses 1.3 as default. So check - // whether a source version is specified, and if not supply 1.3 explicitly. + // whether a source version is specified, and if not supply 8 explicitly. if (!haveSourceOrReleaseArgument(args)) { - getLog().debug("ecj: no source level nor release specified, defaulting to Java 1.3"); + getLog().debug("ecj: no source level nor release specified, defaulting to Java 8"); args.add("-source"); - args.add("1.3"); + args.add("8"); } // Also check for the encoding. Could have been set via the CompilerConfig diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerErrorsAsWarningsTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerErrorsAsWarningsTest.java index 91580922..75c5279a 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerErrorsAsWarningsTest.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerErrorsAsWarningsTest.java @@ -36,15 +36,21 @@ protected int expectedWarnings() { @Override protected Collection expectedOutputFiles() { + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0") + || javaVersion.contains("11") + || javaVersion.contains("17") + || javaVersion.contains("21") + || javaVersion.contains("23")) { + return Arrays.asList( + "org/codehaus/foo/Deprecation.class", + "org/codehaus/foo/ExternalDeps.class", + "org/codehaus/foo/Person.class"); + } return Arrays.asList( "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class", "org/codehaus/foo/Person.class", - "org/codehaus/foo/ReservedWord.class" - // "org/codehaus/foo/Bad.class", // This one has no class file generated as it's one big - // issue - // "org/codehaus/foo/UnknownSymbol.class", - // "org/codehaus/foo/RightClassname.class" - ); + "org/codehaus/foo/ReservedWord.class"); } } diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerFailOnWarningsTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerFailOnWarningsTest.java index c5a94b3d..bf87e8e8 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerFailOnWarningsTest.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerFailOnWarningsTest.java @@ -19,16 +19,27 @@ protected String getRoleHint() { @Override protected int expectedErrors() { - return 6; + return 5; } @Override protected int expectedWarnings() { - return 1; + return 0; } @Override protected Collection expectedOutputFiles() { + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0") + || javaVersion.contains("11") + || javaVersion.contains("17") + || javaVersion.contains("21") + || javaVersion.contains("23")) { + return Arrays.asList( + "org/codehaus/foo/Deprecation.class", + "org/codehaus/foo/ExternalDeps.class", + "org/codehaus/foo/Person.class"); + } return Arrays.asList( "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class", diff --git a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java index de72e6b4..042bddb2 100644 --- a/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java +++ b/plexus-compilers/plexus-compiler-eclipse/src/test/java/org/codehaus/plexus/compiler/eclipse/EclipseCompilerTest.java @@ -53,16 +53,27 @@ protected String getRoleHint() { @Override protected int expectedErrors() { - return 4; + return 5; } @Override protected int expectedWarnings() { - return 2; + return 1; } @Override protected Collection expectedOutputFiles() { + String javaVersion = getJavaVersion(); + if (javaVersion.contains("9.0") + || javaVersion.contains("11") + || javaVersion.contains("17") + || javaVersion.contains("21") + || javaVersion.contains("23")) { + return Arrays.asList( + "org/codehaus/foo/Deprecation.class", + "org/codehaus/foo/ExternalDeps.class", + "org/codehaus/foo/Person.class"); + } return Arrays.asList( "org/codehaus/foo/Deprecation.class", "org/codehaus/foo/ExternalDeps.class",