diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java index 2e3da2fc..579e6280 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java @@ -46,13 +46,13 @@ public abstract class AbstractCompiler protected static final String PS = System.getProperty( "path.separator" ); - private CompilerOutputStyle compilerOutputStyle; + private final CompilerOutputStyle compilerOutputStyle; - private String inputFileEnding; + private final String inputFileEnding; - private String outputFileEnding; + private final String outputFileEnding; - private String outputFile; + private final String outputFile; // ---------------------------------------------------------------------- // @@ -152,7 +152,7 @@ protected static Set getSourceFilesForSourceRoot( CompilerConfiguration if ( includes != null && !includes.isEmpty() ) { - String[] inclStrs = includes.toArray( new String[includes.size()] ); + String[] inclStrs = includes.toArray( new String[0] ); scanner.setIncludes( inclStrs ); } else @@ -164,7 +164,7 @@ protected static Set getSourceFilesForSourceRoot( CompilerConfiguration if ( excludes != null && !excludes.isEmpty() ) { - String[] exclStrs = excludes.toArray( new String[excludes.size()] ); + String[] exclStrs = excludes.toArray( new String[0] ); scanner.setExcludes( exclStrs ); } @@ -213,7 +213,7 @@ protected static String[] getSourceFiles( CompilerConfiguration config ) } else { - result = sources.toArray( new String[sources.size()] ); + result = sources.toArray( new String[0] ); } return result; diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerMessage.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerMessage.java index 8f9a0048..5ca5a659 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerMessage.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerMessage.java @@ -339,11 +339,8 @@ public enum Kind */ WARNING( "warning" ); - private String type; - - private Kind( final String type ) + Kind( String type ) { - this.type = type; } } } diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerOutputStyle.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerOutputStyle.java index c51a734e..f7e0a280 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerOutputStyle.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerOutputStyle.java @@ -57,7 +57,7 @@ public String toString() public boolean equals( Object other ) { - if ( other == null || !( other instanceof CompilerOutputStyle ) ) + if ( !( other instanceof CompilerOutputStyle ) ) { return false; } diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/StreamPumper.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/StreamPumper.java index 5261806d..fc13661d 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/StreamPumper.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/StreamPumper.java @@ -36,13 +36,13 @@ public class StreamPumper { private static final int BUFFER_SIZE = 512; - private BufferedInputStream stream; + private final BufferedInputStream stream; private boolean endOfStream = false; private int SLEEP_TIME = 5; - private OutputStream out; + private final OutputStream out; public StreamPumper( BufferedInputStream is, OutputStream out ) { diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScanner.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScanner.java index 02137c17..44af00a8 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScanner.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScanner.java @@ -56,7 +56,7 @@ protected String[] scanForSources( File sourceDir, Set sourceIncludes, S } else { - includes = sourceIncludes.toArray( new String[sourceIncludes.size()] ); + includes = sourceIncludes.toArray( new String[0] ); } ds.setIncludes( includes ); @@ -68,7 +68,7 @@ protected String[] scanForSources( File sourceDir, Set sourceIncludes, S } else { - excludes = sourceExcludes.toArray( new String[sourceExcludes.size()] ); + excludes = sourceExcludes.toArray( new String[0] ); } ds.setExcludes( excludes ); diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScanner.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScanner.java index 967e5672..a420a3a6 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScanner.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScanner.java @@ -38,9 +38,9 @@ public class SimpleSourceInclusionScanner extends AbstractSourceInclusionScanner { - private Set sourceIncludes; + private final Set sourceIncludes; - private Set sourceExcludes; + private final Set sourceExcludes; public SimpleSourceInclusionScanner( Set sourceIncludes, Set sourceExcludes ) { diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScanner.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScanner.java index dc4f7d7a..d255be5d 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScanner.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScanner.java @@ -42,12 +42,12 @@ public class StaleSourceScanner public StaleSourceScanner() { - this( 0, Collections.singleton( "**/*" ), Collections.emptySet() ); + this( 0, Collections.singleton( "**/*" ), Collections.emptySet() ); } public StaleSourceScanner( long lastUpdatedWithinMsecs ) { - this( lastUpdatedWithinMsecs, Collections.singleton( "**/*" ), Collections.emptySet() ); + this( lastUpdatedWithinMsecs, Collections.singleton( "**/*" ), Collections.emptySet() ); } public StaleSourceScanner( long lastUpdatedWithinMsecs, Set sourceIncludes, Set sourceExcludes ) diff --git a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SingleTargetSourceMapping.java b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SingleTargetSourceMapping.java index a6273e5b..c68ca279 100644 --- a/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SingleTargetSourceMapping.java +++ b/plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SingleTargetSourceMapping.java @@ -38,9 +38,9 @@ public class SingleTargetSourceMapping implements SourceMapping { - private String sourceSuffix; + private final String sourceSuffix; - private String outputFile; + private final String outputFile; public SingleTargetSourceMapping( String sourceSuffix, String outputFile ) { diff --git a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java index a0c54090..2a2263d9 100644 --- a/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java +++ b/plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavacCompiler.java @@ -105,7 +105,7 @@ public class JavacCompiler private static volatile Class JAVAC_CLASS; - private List> javaccClasses = new CopyOnWriteArrayList<>(); + private final List> javaccClasses = new CopyOnWriteArrayList<>(); @Requirement private InProcessCompiler inProcessCompiler; @@ -432,7 +432,7 @@ else if ( !suppressSource( config ) ) args.add( value ); } - return args.toArray( new String[args.size()] ); + return args.toArray( new String[0] ); } /**