You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2016/05/05 20:24:48 UTC

maven git commit: Code polishing o Replaced static initializer block with unmodifiableList() list to make sure the list itself will never being changed.

Repository: maven
Updated Branches:
  refs/heads/master 0535716fd -> 6d67fb246


Code polishing
 o Replaced static initializer block with unmodifiableList()
   list to make sure the list itself will never being changed.


Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/6d67fb24
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/6d67fb24
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/6d67fb24

Branch: refs/heads/master
Commit: 6d67fb2464f5cf1d5e84442c0ca1456b94f2fedf
Parents: 0535716
Author: Karl Heinz Marbaise <kh...@apache.org>
Authored: Thu May 5 22:23:27 2016 +0200
Committer: Karl Heinz Marbaise <kh...@apache.org>
Committed: Thu May 5 22:24:28 2016 +0200

----------------------------------------------------------------------
 .../AbstractStringBasedModelInterpolator.java   | 38 ++++++++------------
 1 file changed, 14 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/6d67fb24/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
----------------------------------------------------------------------
diff --git a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
index cee376f..2bd8183 100644
--- a/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
+++ b/maven-model-builder/src/main/java/org/apache/maven/model/interpolation/AbstractStringBasedModelInterpolator.java
@@ -23,7 +23,7 @@ import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
+import java.util.Collections;
 import java.util.List;
 import java.util.Properties;
 
@@ -56,29 +56,19 @@ import org.codehaus.plexus.interpolation.ValueSource;
 public abstract class AbstractStringBasedModelInterpolator
     implements ModelInterpolator
 {
-    private static final List<String> PROJECT_PREFIXES = Arrays.asList( "pom.", "project." );
-
-    private static final Collection<String> TRANSLATED_PATH_EXPRESSIONS;
-
-    static
-    {
-        Collection<String> translatedPrefixes = new HashSet<>();
-
-        // MNG-1927, MNG-2124, MNG-3355:
-        // If the build section is present and the project directory is non-null, we should make
-        // sure interpolation of the directories below uses translated paths.
-        // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the
-        // code below...
-        translatedPrefixes.add( "build.directory" );
-        translatedPrefixes.add( "build.outputDirectory" );
-        translatedPrefixes.add( "build.testOutputDirectory" );
-        translatedPrefixes.add( "build.sourceDirectory" );
-        translatedPrefixes.add( "build.testSourceDirectory" );
-        translatedPrefixes.add( "build.scriptSourceDirectory" );
-        translatedPrefixes.add( "reporting.outputDirectory" );
-
-        TRANSLATED_PATH_EXPRESSIONS = translatedPrefixes;
-    }
+    private static final List<String> PROJECT_PREFIXES =
+        Collections.unmodifiableList( Arrays.asList( "pom.", "project." ) );
+
+    // MNG-1927, MNG-2124, MNG-3355:
+    // If the build section is present and the project directory is non-null, we should make
+    // sure interpolation of the directories below uses translated paths.
+    // Afterward, we'll double back and translate any paths that weren't covered during interpolation via the
+    // code below...
+    private static final Collection<String> TRANSLATED_PATH_EXPRESSIONS =
+        Collections.unmodifiableList( Arrays.asList( "build.directory", "build.outputDirectory",
+                                                     "build.testOutputDirectory", "build.sourceDirectory",
+                                                     "build.testSourceDirectory", "build.scriptSourceDirectory",
+                                                     "reporting.outputDirectory" ) );
 
     @Requirement
     private PathTranslator pathTranslator;