This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git
commit 5b47fbe2d4ec0a5d6b03a28959810ea71cbb8830 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Tue Nov 17 02:38:43 2026 +0000 Use System.lineSeparator(), @Override and try-with-resources --- .../org/apache/maven/plugin/compiler/TestCompilerMojo.java | 11 +++++++++++ .../maven/plugin/compiler/stubs/CompilerManagerStub.java | 1 + .../org/apache/maven/plugin/compiler/stubs/CompilerStub.java | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java index 2726b713..2e6f8aa2 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java @@ -207,6 +207,7 @@ public class TestCompilerMojo extends AbstractCompilerMojo { private Collection<String> modulepathElements; + @Override public void execute() throws MojoExecutionException, CompilationFailureException { if (skip) { getLog().info("Not compiling test sources"); @@ -215,6 +216,7 @@ public class TestCompilerMojo extends AbstractCompilerMojo { super.execute(); } + @Override protected List<String> getCompileSourceRoots() { return compileSourceRoots; } @@ -224,6 +226,7 @@ public class TestCompilerMojo extends AbstractCompilerMojo { return pathElements; } + @Override protected List<String> getClasspathElements() { return new ArrayList<>(classpathElements); } @@ -233,6 +236,7 @@ public class TestCompilerMojo extends AbstractCompilerMojo { return new ArrayList<>(modulepathElements); } + @Override protected File getOutputDirectory() { return outputDirectory; } @@ -450,6 +454,7 @@ public class TestCompilerMojo extends AbstractCompilerMojo { compilerArgs.add(moduleName + '=' + patchPath); } + @Override protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) { SourceInclusionScanner scanner; @@ -467,6 +472,7 @@ public class TestCompilerMojo extends AbstractCompilerMojo { return scanner; } + @Override protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) { SourceInclusionScanner scanner; @@ -492,10 +498,12 @@ public class TestCompilerMojo extends AbstractCompilerMojo { return getJavaMajorVersion(version) < 9; } + @Override protected String getSource() { return testSource == null ? source : testSource; } + @Override protected String getTarget() { return testTarget == null ? target : testTarget; } @@ -505,15 +513,18 @@ public class TestCompilerMojo extends AbstractCompilerMojo { return testRelease == null ? release : testRelease; } + @Override protected String getCompilerArgument() { return testCompilerArgument == null ? compilerArgument : testCompilerArgument; } + @Override @SuppressWarnings("deprecation") protected Map<String, String> getCompilerArguments() { return testCompilerArguments == null ? compilerArguments : testCompilerArguments; } + @Override protected File getGeneratedSourcesDirectory() { return generatedTestSourcesDirectory; } diff --git a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java index 59f0a839..4d255d8d 100644 --- a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java +++ b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java @@ -34,6 +34,7 @@ public class CompilerManagerStub implements CompilerManager { this.shouldFail = shouldFail; } + @Override public org.codehaus.plexus.compiler.Compiler getCompiler(String compilerId) { return new CompilerStub(shouldFail); } diff --git a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java index 8131fa77..7163f7ae 100644 --- a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java +++ b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java @@ -42,26 +42,32 @@ public class CompilerStub implements org.codehaus.plexus.compiler.Compiler { this.shouldFail = shouldFail; } + @Override public CompilerOutputStyle getCompilerOutputStyle() { return CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES; } + @Override public String getInputFileEnding(CompilerConfiguration compilerConfiguration) { return "java"; } + @Override public String getOutputFileEnding(CompilerConfiguration compilerConfiguration) { return "class"; } + @Override public String getOutputFile(CompilerConfiguration compilerConfiguration) { return "output-file"; } + @Override public boolean canUpdateTarget(CompilerConfiguration compilerConfiguration) { return false; } + @Override public CompilerResult performCompile(CompilerConfiguration compilerConfiguration) throws CompilerException { File outputDir = new File(compilerConfiguration.getOutputLocation()); @@ -80,6 +86,7 @@ public class CompilerStub implements org.codehaus.plexus.compiler.Compiler { !shouldFail, Collections.singletonList(new CompilerMessage("message 1", CompilerMessage.Kind.OTHER))); } + @Override public String[] createCommandLine(CompilerConfiguration compilerConfiguration) { return new String[0]; }
