This is an automated email from the ASF dual-hosted git repository.

olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git

commit 875947802d28bcf8348eb634985c0512a790170a
Author: olivier lamy <[email protected]>
AuthorDate: Mon Nov 19 16:11:43 2018 +1000

    use some 1.7 sugar syntax
    
    Signed-off-by: olivier lamy <[email protected]>
---
 .../plugin/compiler/AbstractCompilerMojo.java      | 41 +++++++---------------
 .../apache/maven/plugin/compiler/CompilerMojo.java | 16 ++++-----
 .../maven/plugin/compiler/TestCompilerMojo.java    |  6 ++--
 3 files changed, 24 insertions(+), 39 deletions(-)

diff --git 
a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
index c1bd5be..0ac1e27 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java
@@ -974,7 +974,7 @@ public abstract class AbstractCompilerMojo
         }
         
 
-        List<String> jpmsLines = new ArrayList<String>();
+        List<String> jpmsLines = new ArrayList<>();
         
         // See http://openjdk.java.net/jeps/261
         final List<String> runtimeArgs = Arrays.asList( 
"--upgrade-module-path", 
@@ -1155,9 +1155,9 @@ public abstract class AbstractCompilerMojo
             }
         }
 
-        List<CompilerMessage> warnings = new ArrayList<CompilerMessage>();
-        List<CompilerMessage> errors = new ArrayList<CompilerMessage>();
-        List<CompilerMessage> others = new ArrayList<CompilerMessage>();
+        List<CompilerMessage> warnings = new ArrayList<>();
+        List<CompilerMessage> errors = new ArrayList<>();
+        List<CompilerMessage> others = new ArrayList<>();
         for ( CompilerMessage message : compilerResult.getCompilerMessages() )
         {
             if ( message.getKind() == CompilerMessage.Kind.ERROR )
@@ -1255,7 +1255,7 @@ public abstract class AbstractCompilerMojo
         {
             return new CompilerResult();
         }
-        List<CompilerMessage> messages = new ArrayList<CompilerMessage>( 
compilerErrors.size() );
+        List<CompilerMessage> messages = new ArrayList<>( 
compilerErrors.size() );
         boolean success = true;
         for ( CompilerError compilerError : compilerErrors )
         {
@@ -1291,7 +1291,7 @@ public abstract class AbstractCompilerMojo
 
         scanner.addSourceMapping( mapping );
 
-        Set<File> compileSources = new HashSet<File>();
+        Set<File> compileSources = new HashSet<>();
 
         for ( String sourceRoot : getCompileSourceRoots() )
         {
@@ -1427,23 +1427,8 @@ public abstract class AbstractCompilerMojo
                     tc = tcs.get( 0 );
                 }
             }
-            catch ( NoSuchMethodException e )
-            {
-                // ignore
-            }
-            catch ( SecurityException e )
-            {
-                // ignore
-            }
-            catch ( IllegalAccessException e )
-            {
-                // ignore
-            }
-            catch ( IllegalArgumentException e )
-            {
-                // ignore
-            }
-            catch ( InvocationTargetException e )
+            catch ( NoSuchMethodException | SecurityException | 
IllegalAccessException | IllegalArgumentException
+                | InvocationTargetException e )
             {
                 // ignore
             }
@@ -1488,7 +1473,7 @@ public abstract class AbstractCompilerMojo
 
         scanner.addSourceMapping( mapping );
 
-        Set<File> staleSources = new HashSet<File>();
+        Set<File> staleSources = new HashSet<>();
 
         for ( String sourceRoot : getCompileSourceRoots() )
         {
@@ -1543,7 +1528,7 @@ public abstract class AbstractCompilerMojo
      */
     private static List<String> removeEmptyCompileSourceRoots( List<String> 
compileSourceRootsList )
     {
-        List<String> newCompileSourceRootsList = new ArrayList<String>();
+        List<String> newCompileSourceRootsList = new ArrayList<>();
         if ( compileSourceRootsList != null )
         {
             // copy as I may be modifying it
@@ -1576,13 +1561,13 @@ public abstract class AbstractCompilerMojo
 
         if ( fileExtensions == null || fileExtensions.isEmpty() )
         {
-            fileExtensions = new ArrayList<String>();
+            fileExtensions = new ArrayList<>();
             fileExtensions.add( "class" );
         }
 
         Date buildStartTime = getBuildStartTime();
 
-        List<String> pathElements = new ArrayList<String>();
+        List<String> pathElements = new ArrayList<>();
         pathElements.addAll( getClasspathElements() );
         pathElements.addAll( getModulepathElements() );
         
@@ -1646,7 +1631,7 @@ public abstract class AbstractCompilerMojo
 
         try
         {
-            Set<Artifact> requiredArtifacts = new LinkedHashSet<Artifact>();
+            Set<Artifact> requiredArtifacts = new LinkedHashSet<>();
 
             for ( DependencyCoordinate coord : annotationProcessorPaths )
             {
diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java 
b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index ddf6c50..568b063 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -87,13 +87,13 @@ public class CompilerMojo
      * A list of inclusion filters for the compiler.
      */
     @Parameter
-    private Set<String> includes = new HashSet<String>();
+    private Set<String> includes = new HashSet<>();
 
     /**
      * A list of exclusion filters for the compiler.
      */
     @Parameter
-    private Set<String> excludes = new HashSet<String>();
+    private Set<String> excludes = new HashSet<>();
 
     /**
      * <p>
@@ -216,9 +216,9 @@ public class CompilerMojo
             // and we can detect if auto modules are used. In that case, 
MavenProject.setFile() should not be used, so
             // you cannot depend on this project and so it won't be 
distributed.
 
-            modulepathElements = new ArrayList<String>( compilePath.size() );
-            classpathElements = new ArrayList<String>( compilePath.size() );
-            pathElements = new LinkedHashMap<String, JavaModuleDescriptor>( 
compilePath.size() );
+            modulepathElements = new ArrayList<>( compilePath.size() );
+            classpathElements = new ArrayList<>( compilePath.size() );
+            pathElements = new LinkedHashMap<>( compilePath.size() );
 
             ResolvePathsResult<File> resolvePathsResult;
             try
@@ -284,7 +284,7 @@ public class CompilerMojo
                     {
                         if ( compilerArgs == null )
                         {
-                            compilerArgs = new ArrayList<String>();
+                            compilerArgs = new ArrayList<>();
                         }
                         
                         if ( getOutputDirectory().toPath().startsWith( 
file.getPath() ) )
@@ -307,7 +307,7 @@ public class CompilerMojo
                 
                 if ( compilerArgs == null )
                 {
-                    compilerArgs = new ArrayList<String>();
+                    compilerArgs = new ArrayList<>();
                 }
                 compilerArgs.add( "--module-version" );
                 compilerArgs.add( getProject().getVersion() );
@@ -328,7 +328,7 @@ public class CompilerMojo
     private List<File> getCompileClasspathElements( MavenProject project )
     {
         // 3 is outputFolder + 2 preserved for multirelease  
-        List<File> list = new ArrayList<File>( project.getArtifacts().size() + 
3 );
+        List<File> list = new ArrayList<>( project.getArtifacts().size() + 3 );
 
         if ( multiReleaseOutput )
         {
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 b666a60..f8b9ba1 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
@@ -83,13 +83,13 @@ public class TestCompilerMojo
      * A list of inclusion filters for the compiler.
      */
     @Parameter
-    private Set<String> testIncludes = new HashSet<String>();
+    private Set<String> testIncludes = new HashSet<>();
 
     /**
      * A list of exclusion filters for the compiler.
      */
     @Parameter
-    private Set<String> testExcludes = new HashSet<String>();
+    private Set<String> testExcludes = new HashSet<>();
 
     /**
      * The -source argument for the test Java compiler.
@@ -266,7 +266,7 @@ public class TestCompilerMojo
 
             mainModuleDescriptor = result.getMainModuleDescriptor();
 
-            pathElements = new LinkedHashMap<String, JavaModuleDescriptor>( 
result.getPathElements().size() );
+            pathElements = new LinkedHashMap<>( 
result.getPathElements().size() );
             pathElements.putAll( result.getPathElements() );
 
             modulepathElements = result.getModulepathElements().keySet();

Reply via email to