Skip to content

Commit

Permalink
minor cleanup (#198)
Browse files Browse the repository at this point in the history
* minor cleanup

Signed-off-by: Olivier Lamy <olamy@apache.org>
  • Loading branch information
olamy committed Mar 6, 2022
1 parent e5316f6 commit 84bcd28
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

// ----------------------------------------------------------------------
//
Expand Down Expand Up @@ -152,7 +152,7 @@ protected static Set<String> 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
Expand All @@ -164,7 +164,7 @@ protected static Set<String> 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 );
}

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,8 @@ public enum Kind
*/
WARNING( "warning" );

private String type;

private Kind( final String type )
Kind( String type )
{
this.type = type;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public String toString()

public boolean equals( Object other )
{
if ( other == null || !( other instanceof CompilerOutputStyle ) )
if ( !( other instanceof CompilerOutputStyle ) )
{
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected String[] scanForSources( File sourceDir, Set<String> sourceIncludes, S
}
else
{
includes = sourceIncludes.toArray( new String[sourceIncludes.size()] );
includes = sourceIncludes.toArray( new String[0] );
}

ds.setIncludes( includes );
Expand All @@ -68,7 +68,7 @@ protected String[] scanForSources( File sourceDir, Set<String> sourceIncludes, S
}
else
{
excludes = sourceExcludes.toArray( new String[sourceExcludes.size()] );
excludes = sourceExcludes.toArray( new String[0] );
}

ds.setExcludes( excludes );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
public class SimpleSourceInclusionScanner
extends AbstractSourceInclusionScanner
{
private Set<String> sourceIncludes;
private final Set<String> sourceIncludes;

private Set<String> sourceExcludes;
private final Set<String> sourceExcludes;

public SimpleSourceInclusionScanner( Set<String> sourceIncludes, Set<String> sourceExcludes )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ public class StaleSourceScanner

public StaleSourceScanner()
{
this( 0, Collections.singleton( "**/*" ), Collections.<String>emptySet() );
this( 0, Collections.singleton( "**/*" ), Collections.emptySet() );
}

public StaleSourceScanner( long lastUpdatedWithinMsecs )
{
this( lastUpdatedWithinMsecs, Collections.singleton( "**/*" ), Collections.<String>emptySet() );
this( lastUpdatedWithinMsecs, Collections.singleton( "**/*" ), Collections.emptySet() );
}

public StaleSourceScanner( long lastUpdatedWithinMsecs, Set<String> sourceIncludes, Set<String> sourceExcludes )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public class JavacCompiler

private static volatile Class<?> JAVAC_CLASS;

private List<Class<?>> javaccClasses = new CopyOnWriteArrayList<>();
private final List<Class<?>> javaccClasses = new CopyOnWriteArrayList<>();

@Requirement
private InProcessCompiler inProcessCompiler;
Expand Down Expand Up @@ -432,7 +432,7 @@ else if ( !suppressSource( config ) )
args.add( value );
}

return args.toArray( new String[args.size()] );
return args.toArray( new String[0] );
}

/**
Expand Down

0 comments on commit 84bcd28

Please sign in to comment.