You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2021/09/04 08:43:04 UTC

[maven-compiler-plugin] branch MCOMPILER-398 created (now 0a0cbca)

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

rfscholte pushed a change to branch MCOMPILER-398
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git.


      at 0a0cbca  Simplify CompilerMojo's getSourceInclusionScanner

This branch includes the following new commits:

     new f325202  Simplify logic around scanning for includes/excludes
     new 0a0cbca  Simplify CompilerMojo's getSourceInclusionScanner

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[maven-compiler-plugin] 01/02: Simplify logic around scanning for includes/excludes

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit f3252025970c345be8ac0e54f5136656b073d3ce
Author: Russell Howe <rh...@siksai.co.uk>
AuthorDate: Sun Sep 22 09:40:26 2019 +0100

    Simplify logic around scanning for includes/excludes
    
    The 'getSourceInclusionScanner' method can be simplified quite considerably.
    
    In the case where there are no includes or excludes, we can simply reuse the
    empty set of excludes we have rather than pulling an empty set out of
    Collections. This then makes both constructor calls to
    SimpleSourceInclusionScanner the same, so they can be merged.
    
    For the case where there are no includes, there are two paths. When there are
    also no excludes, we construct a singleton set of the default include pattern
    and assign it to includes. In the other case, where we have excludes but no
    includes, we add the defaultIncludePattern to the empty set of includes we
    have. These are equivalent operations, so merge them as well.
    
    i.e. have some default includes but allow this to be overridden and also allow
    excludes to be specified.
---
 .../org/apache/maven/plugin/compiler/CompilerMojo.java  | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

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 87f3bae..4df2dd0 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -381,26 +381,15 @@ public class CompilerMojo
 
     protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEnding )
     {
-        SourceInclusionScanner scanner;
-
         // it's not defined if we get the ending with or without the dot '.'
         String defaultIncludePattern = "**/*" + ( inputFileEnding.startsWith( "." ) ? "" : "." ) + inputFileEnding;
 
-        if ( includes.isEmpty() && excludes.isEmpty() )
-        {
-            includes = Collections.singleton( defaultIncludePattern );
-            scanner = new SimpleSourceInclusionScanner( includes, Collections.<String>emptySet() );
-        }
-        else
+        if ( includes.isEmpty() )
         {
-            if ( includes.isEmpty() )
-            {
-                includes.add( defaultIncludePattern );
-            }
-            scanner = new SimpleSourceInclusionScanner( includes, excludes );
+            includes.add( defaultIncludePattern );
         }
 
-        return scanner;
+        return new SimpleSourceInclusionScanner( includes, excludes );
     }
 
     protected String getSource()

[maven-compiler-plugin] 02/02: Simplify CompilerMojo's getSourceInclusionScanner

Posted by rf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0a0cbcaf8c64e738c2e9cef36c473cbd3bb0c232
Author: Russell Howe <rh...@siksai.co.uk>
AuthorDate: Mon Sep 23 08:54:06 2019 +0100

    Simplify CompilerMojo's getSourceInclusionScanner
    
    Make the flow through this method clearer.
---
 .../org/apache/maven/plugin/compiler/CompilerMojo.java    | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

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 4df2dd0..6598253 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -361,22 +361,17 @@ public class CompilerMojo
     
     protected SourceInclusionScanner getSourceInclusionScanner( int staleMillis )
     {
-        SourceInclusionScanner scanner;
-
         if ( includes.isEmpty() && excludes.isEmpty() )
         {
-            scanner = new StaleSourceScanner( staleMillis );
+            return new StaleSourceScanner( staleMillis );
         }
-        else
+
+        if ( includes.isEmpty() )
         {
-            if ( includes.isEmpty() )
-            {
-                includes.add( "**/*.java" );
-            }
-            scanner = new StaleSourceScanner( staleMillis, includes, excludes );
+            includes.add( "**/*.java" );
         }
 
-        return scanner;
+        return new StaleSourceScanner( staleMillis, includes, excludes );
     }
 
     protected SourceInclusionScanner getSourceInclusionScanner( String inputFileEnding )