Skip to content

Commit 6196e40

Browse files
committed
some java 1.7 sugar syntax
Signed-off-by: olivier lamy <[email protected]>
1 parent 060ab7c commit 6196e40

File tree

9 files changed

+33
-33
lines changed

9 files changed

+33
-33
lines changed

plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/AbstractCompiler.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public abstract class AbstractCompiler
4242
extends AbstractLogEnabled
4343
implements Compiler
4444
{
45-
protected static final String EOL = System.getProperty( "line.separator" );
45+
protected static final String EOL = System.lineSeparator();
4646

4747
protected static final String PS = System.getProperty( "path.separator" );
4848

@@ -172,7 +172,7 @@ protected static Set<String> getSourceFilesForSourceRoot( CompilerConfiguration
172172

173173
String[] sourceDirectorySources = scanner.getIncludedFiles();
174174

175-
Set<String> sources = new HashSet<String>();
175+
Set<String> sources = new HashSet<>();
176176

177177
for ( String sourceDirectorySource : sourceDirectorySources )
178178
{
@@ -186,7 +186,7 @@ protected static Set<String> getSourceFilesForSourceRoot( CompilerConfiguration
186186

187187
protected static String[] getSourceFiles( CompilerConfiguration config )
188188
{
189-
Set<String> sources = new HashSet<String>();
189+
Set<String> sources = new HashSet<>();
190190

191191
Set<File> sourceFiles = config.getSourceFiles();
192192

plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerConfiguration.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,21 @@ public class CompilerConfiguration
4343
{
4444
private String outputLocation;
4545

46-
private List<String> classpathEntries = new LinkedList<String>();
46+
private List<String> classpathEntries = new LinkedList<>();
4747

48-
private List<String> modulepathEntries = new LinkedList<String>();
48+
private List<String> modulepathEntries = new LinkedList<>();
4949

5050
// ----------------------------------------------------------------------
5151
// Source Files
5252
// ----------------------------------------------------------------------
5353

54-
private Set<File> sourceFiles = new HashSet<File>();
54+
private Set<File> sourceFiles = new HashSet<>();
5555

56-
private List<String> sourceLocations = new LinkedList<String>();
56+
private List<String> sourceLocations = new LinkedList<>();
5757

58-
private Set<String> includes = new HashSet<String>();
58+
private Set<String> includes = new HashSet<>();
5959

60-
private Set<String> excludes = new HashSet<String>();
60+
private Set<String> excludes = new HashSet<>();
6161

6262
// ----------------------------------------------------------------------
6363
// Compiler Settings
@@ -92,7 +92,7 @@ public class CompilerConfiguration
9292
*/
9393
private String moduleVersion;
9494

95-
private Collection<Map.Entry<String,String>> customCompilerArguments = new ArrayList<Map.Entry<String,String>>();
95+
private Collection<Map.Entry<String,String>> customCompilerArguments = new ArrayList<>();
9696

9797
private boolean fork;
9898

@@ -150,7 +150,7 @@ public class CompilerConfiguration
150150
private List<String> processorPathEntries;
151151

152152
/**
153-
* default value {@link CompilerReuseStrategy.ReuseCreated}
153+
* default value {@link CompilerReuseStrategy#ReuseCreated}
154154
*
155155
* @since 1.9
156156
*/
@@ -193,7 +193,7 @@ public void setClasspathEntries( List<String> classpathEntries )
193193
}
194194
else
195195
{
196-
this.classpathEntries = new LinkedList<String>( classpathEntries );
196+
this.classpathEntries = new LinkedList<>( classpathEntries );
197197
}
198198
}
199199

@@ -219,7 +219,7 @@ public void setModulepathEntries( List<String> modulepathEntries )
219219
}
220220
else
221221
{
222-
this.modulepathEntries = new LinkedList<String>( modulepathEntries );
222+
this.modulepathEntries = new LinkedList<>( modulepathEntries );
223223
}
224224
}
225225

@@ -240,7 +240,7 @@ public void setSourceFiles( Set<File> sourceFiles )
240240
}
241241
else
242242
{
243-
this.sourceFiles = new HashSet<File>( sourceFiles );
243+
this.sourceFiles = new HashSet<>( sourceFiles );
244244
}
245245
}
246246

@@ -262,7 +262,7 @@ public void setSourceLocations( List<String> sourceLocations )
262262
}
263263
else
264264
{
265-
this.sourceLocations = new LinkedList<String>( sourceLocations );
265+
this.sourceLocations = new LinkedList<>( sourceLocations );
266266
}
267267
}
268268

@@ -284,7 +284,7 @@ public void setIncludes( Set<String> includes )
284284
}
285285
else
286286
{
287-
this.includes = new HashSet<String>( includes );
287+
this.includes = new HashSet<>( includes );
288288
}
289289
}
290290

@@ -306,7 +306,7 @@ public void setExcludes( Set<String> excludes )
306306
}
307307
else
308308
{
309-
this.excludes = new HashSet<String>( excludes );
309+
this.excludes = new HashSet<>( excludes );
310310
}
311311
}
312312

@@ -421,7 +421,7 @@ public void setModuleVersion( String moduleVersion )
421421

422422
public void addCompilerCustomArgument( String customArgument, String value )
423423
{
424-
customCompilerArguments.add( new AbstractMap.SimpleImmutableEntry<String, String>( customArgument, value ) );
424+
customCompilerArguments.add( new AbstractMap.SimpleImmutableEntry<>( customArgument, value ) );
425425
}
426426

427427
/**
@@ -431,7 +431,7 @@ public void addCompilerCustomArgument( String customArgument, String value )
431431
@Deprecated
432432
public LinkedHashMap<String, String> getCustomCompilerArguments()
433433
{
434-
LinkedHashMap<String, String> arguments = new LinkedHashMap<String, String>( customCompilerArguments.size() );
434+
LinkedHashMap<String, String> arguments = new LinkedHashMap<>( customCompilerArguments.size() );
435435
for ( Map.Entry<String, String> entry : customCompilerArguments )
436436
{
437437
arguments.put( entry.getKey(), entry.getValue() );
@@ -457,7 +457,7 @@ public void setCustomCompilerArguments( LinkedHashMap<String, String> customComp
457457
*/
458458
public Map<String, String> getCustomCompilerArgumentsAsMap()
459459
{
460-
LinkedHashMap<String, String> arguments = new LinkedHashMap<String, String>( customCompilerArguments.size() );
460+
LinkedHashMap<String, String> arguments = new LinkedHashMap<>( customCompilerArguments.size() );
461461
for ( Map.Entry<String, String> entry : customCompilerArguments )
462462
{
463463
arguments.put( entry.getKey(), entry.getValue() );
@@ -467,7 +467,7 @@ public Map<String, String> getCustomCompilerArgumentsAsMap()
467467

468468
public void setCustomCompilerArgumentsAsMap( Map<String, String> customCompilerArguments )
469469
{
470-
this.customCompilerArguments = new ArrayList<Map.Entry<String,String>>();
470+
this.customCompilerArguments = new ArrayList<>();
471471
if ( customCompilerArguments != null )
472472
{
473473
this.customCompilerArguments.addAll( customCompilerArguments.entrySet() );
@@ -632,7 +632,7 @@ public String[] getAnnotationProcessors()
632632
*/
633633
public void addProcessorPathEntry(String entry) {
634634
if ( processorPathEntries == null ) {
635-
processorPathEntries = new LinkedList<String>();
635+
processorPathEntries = new LinkedList<>();
636636
}
637637

638638
processorPathEntries.add( entry );

plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/CompilerResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public List<CompilerMessage> getCompilerMessages()
7474
{
7575
if ( compilerMessages == null )
7676
{
77-
this.compilerMessages = new ArrayList<CompilerMessage>();
77+
this.compilerMessages = new ArrayList<>();
7878
}
7979
return compilerMessages;
8080
}

plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/SimpleSourceInclusionScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public Set<File> getIncludedSources( File sourceDir, File targetDir )
6161

6262
String[] potentialSources = scanForSources( sourceDir, sourceIncludes, sourceExcludes );
6363

64-
Set<File> matchingSources = new HashSet<File>( potentialSources != null ? potentialSources.length : 0 );
64+
Set<File> matchingSources = new HashSet<>( potentialSources != null ? potentialSources.length : 0 );
6565

6666
if ( potentialSources != null )
6767
{

plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/StaleSourceScanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public Set<File> getIncludedSources( File sourceDir, File targetDir )
7575

7676
String[] potentialIncludes = scanForSources( sourceDir, sourceIncludes, sourceExcludes );
7777

78-
Set<File> matchingSources = new HashSet<File>();
78+
Set<File> matchingSources = new HashSet<>();
7979

8080
for ( String path : potentialIncludes )
8181
{

plexus-compiler-api/src/main/java/org/codehaus/plexus/compiler/util/scan/mapping/SuffixMapping.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public SuffixMapping( String sourceSuffix, Set<String> targetSuffixes )
4747

4848
public Set<File> getTargetFiles( File targetDir, String source )
4949
{
50-
Set<File> targetFiles = new HashSet<File>();
50+
Set<File> targetFiles = new HashSet<>();
5151

5252
if ( source.endsWith( sourceSuffix ) )
5353
{

plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTckTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
public abstract class AbstractCompilerTckTest
3838
extends PlexusTestCase
3939
{
40-
private static final String EOL = System.getProperty( "line.separator" );
40+
private static final String EOL = System.lineSeparator();
4141

4242
private String roleHint;
4343

plexus-compiler-test/src/main/java/org/codehaus/plexus/compiler/AbstractCompilerTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void setForceJavacCompilerUse( boolean forceJavacCompilerUse )
7474
protected List<String> getClasspath()
7575
throws Exception
7676
{
77-
List<String> cp = new ArrayList<String>();
77+
List<String> cp = new ArrayList<>();
7878

7979
File file = getLocalArtifactPath( "commons-lang", "commons-lang", "2.0", "jar" );
8080

@@ -94,8 +94,8 @@ protected void configureCompilerConfig( CompilerConfiguration compilerConfig )
9494
public void testCompilingSources()
9595
throws Exception
9696
{
97-
List<CompilerMessage> messages = new ArrayList<CompilerMessage>();
98-
Collection<String> files = new TreeSet<String>();
97+
List<CompilerMessage> messages = new ArrayList<>();
98+
Collection<String> files = new TreeSet<>();
9999

100100
for ( CompilerConfiguration compilerConfig : getCompilerConfigurations() )
101101
{
@@ -153,7 +153,7 @@ public void testCompilingSources()
153153
assertEquals( "Wrong number of compilation warnings.", expectedWarnings(), numCompilerWarnings );
154154
}
155155

156-
assertEquals( new TreeSet<String>( normalizePaths( expectedOutputFiles() ) ), files );
156+
assertEquals( new TreeSet<>( normalizePaths( expectedOutputFiles() ) ), files );
157157
}
158158

159159
private List<CompilerConfiguration> getCompilerConfigurations()
@@ -165,7 +165,7 @@ private List<CompilerConfiguration> getCompilerConfigurations()
165165
FileUtils.getFileNames( new File( sourceDir ), "**/*.java", null, false, true );
166166
Collections.sort( filenames );
167167

168-
List<CompilerConfiguration> compilerConfigurations = new ArrayList<CompilerConfiguration>();
168+
List<CompilerConfiguration> compilerConfigurations = new ArrayList<>();
169169

170170
int index = 0;
171171
for ( Iterator<String> it = filenames.iterator(); it.hasNext(); index++ )

plexus-compilers/plexus-compiler-javac/src/main/java/org/codehaus/plexus/compiler/javac/JavaxToolsCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class JavaxToolsCompiler
4949
@SuppressWarnings( "restriction" )
5050
static final JavaCompiler COMPILER = ToolProvider.getSystemJavaCompiler();
5151

52-
private static List<JavaCompiler> JAVA_COMPILERS = new CopyOnWriteArrayList<JavaCompiler>();
52+
private static List<JavaCompiler> JAVA_COMPILERS = new CopyOnWriteArrayList<>();
5353

5454
protected static JavaCompiler getJavaCompiler( CompilerConfiguration compilerConfiguration )
5555
{

0 commit comments

Comments
 (0)