groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [1/6] groovy git commit: minor refactor: groovydoc will be more reproducible using LinkedHash{Set|Map} instead of Hash{Set|Map}
Date Sat, 22 Apr 2017 06:11:55 GMT
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 81f4fd62a -> 1031d90b7


minor refactor: groovydoc will be more reproducible using LinkedHash{Set|Map} instead of Hash{Set|Map}


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/752d06f3
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/752d06f3
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/752d06f3

Branch: refs/heads/GROOVY_2_4_X
Commit: 752d06f387fd0980641a68b971b069ee69e84e8f
Parents: 81f4fd6
Author: paulk <paulk@asert.com.au>
Authored: Sat Apr 22 07:28:26 2017 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Sat Apr 22 16:11:29 2017 +1000

----------------------------------------------------------------------
 .../tools/groovydoc/GroovyDocTemplateEngine.java      | 14 +++++++-------
 .../groovy/tools/groovydoc/MockOutputTool.java        |  8 ++++----
 .../groovy/tools/groovydoc/SimpleGroovyClassDoc.java  | 14 +++++++-------
 .../groovydoc/SimpleGroovyClassDocAssembler.java      |  8 ++++----
 .../groovy/tools/groovydoc/SimpleGroovyRootDoc.java   |  8 ++++----
 5 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/752d06f3/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/GroovyDocTemplateEngine.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/GroovyDocTemplateEngine.java
b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/GroovyDocTemplateEngine.java
index afc0fdc..8633e9b 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/GroovyDocTemplateEngine.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/GroovyDocTemplateEngine.java
@@ -32,8 +32,8 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -66,9 +66,9 @@ public class GroovyDocTemplateEngine {
         this.docTemplatePaths = Arrays.asList(docTemplates);
         this.packageTemplatePaths = Arrays.asList(packageTemplates);
         this.classTemplatePaths = Arrays.asList(classTemplates);
-        this.docTemplates = new HashMap<String, Template>();
-        this.packageTemplates = new HashMap<String, Template>();
-        this.classTemplates = new HashMap<String, Template>();
+        this.docTemplates = new LinkedHashMap<String, Template>();
+        this.packageTemplates = new LinkedHashMap<String, Template>();
+        this.classTemplates = new LinkedHashMap<String, Template>();
         engine = new GStringTemplateEngine();
 
     }
@@ -82,7 +82,7 @@ public class GroovyDocTemplateEngine {
                 t = engine.createTemplate(resourceManager.getReader(templatePath));
                 classTemplates.put(templatePath, t);
             }
-            Map<String, Object> binding = new HashMap<String, Object>();
+            Map<String, Object> binding = new LinkedHashMap<String, Object>();
             binding.put("classDoc", classDoc);
             binding.put("props", properties);
             templateWithBindingApplied = t.make(binding).toString();
@@ -101,7 +101,7 @@ public class GroovyDocTemplateEngine {
                 t = engine.createTemplate(resourceManager.getReader(template));
                 packageTemplates.put(template, t);
             }
-            Map<String, Object> binding = new HashMap<String, Object>();
+            Map<String, Object> binding = new LinkedHashMap<String, Object>();
             binding.put("packageDoc", packageDoc);
             binding.put("props", properties);
             templateWithBindingApplied = t.make(binding).toString();
@@ -120,7 +120,7 @@ public class GroovyDocTemplateEngine {
                 t = engine.createTemplate(resourceManager.getReader(template));
                 docTemplates.put(template, t);
             }
-            Map<String, Object> binding = new HashMap<String, Object>();
+            Map<String, Object> binding = new LinkedHashMap<String, Object>();
             binding.put("rootDoc", rootDoc);
             binding.put("props", properties);
             templateWithBindingApplied = t.make(binding).toString();

http://git-wip-us.apache.org/repos/asf/groovy/blob/752d06f3/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/MockOutputTool.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/MockOutputTool.java
b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/MockOutputTool.java
index 0a384cf..260485d 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/MockOutputTool.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/MockOutputTool.java
@@ -18,8 +18,8 @@
  */
 package org.codehaus.groovy.tools.groovydoc;
 
-import java.util.HashMap;
-import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 
@@ -28,8 +28,8 @@ public class MockOutputTool implements OutputTool {
     Map output;
     
     public MockOutputTool() {
-        outputAreas = new HashSet();
-        output = new HashMap();
+        outputAreas = new LinkedHashSet();
+        output = new LinkedHashMap();
     }
     
     public void makeOutputArea(String filename) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/752d06f3/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
index a55aae8..f81f08e 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDoc.java
@@ -40,7 +40,7 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
     public static final Pattern NAME_ARGS_REGEX = Pattern.compile("([^(]+)\\(([^)]*)\\)");
     public static final Pattern SPLIT_ARGS_REGEX = Pattern.compile(",\\s*");
     private static final List<String> PRIMITIVES = Arrays.asList("void", "boolean",
"byte", "short", "char", "int", "long", "float", "double");
-    private static final Map<String, String> TAG_TEXT = new HashMap<String, String>();
+    private static final Map<String, String> TAG_TEXT = new LinkedHashMap<String,
String>();
     static {
         TAG_TEXT.put("see", "See Also");
         TAG_TEXT.put("param", "Parameters");
@@ -91,7 +91,7 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
     }
 
     public SimpleGroovyClassDoc(List<String> importedClassesAndPackages, String name)
{
-        this(importedClassesAndPackages, new HashMap<String, String>(), name, new ArrayList<LinkArgument>());
+        this(importedClassesAndPackages, new LinkedHashMap<String, String>(), name,
new ArrayList<LinkArgument>());
     }
 
     /**
@@ -249,13 +249,13 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
     }
 
     public Set<GroovyClassDoc> getParentInterfaces() {
-        Set<GroovyClassDoc> result = new HashSet<GroovyClassDoc>();
+        Set<GroovyClassDoc> result = new LinkedHashSet<GroovyClassDoc>();
         result.add(this);
-        Set<GroovyClassDoc> next = new HashSet<GroovyClassDoc>();
+        Set<GroovyClassDoc> next = new LinkedHashSet<GroovyClassDoc>();
         next.addAll(Arrays.asList(this.interfaces()));
         while (!next.isEmpty()) {
             Set<GroovyClassDoc> temp = next;
-            next = new HashSet<GroovyClassDoc>();
+            next = new LinkedHashSet<GroovyClassDoc>();
             for (GroovyClassDoc t : temp) {
                 if (t instanceof SimpleGroovyClassDoc) {
                     next.addAll(((SimpleGroovyClassDoc)t).getParentInterfaces());
@@ -271,7 +271,7 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
     }
 
     private Set<GroovyClassDoc> getJavaInterfaces(ExternalGroovyClassDoc d) {
-        Set<GroovyClassDoc> result = new HashSet<GroovyClassDoc>();
+        Set<GroovyClassDoc> result = new LinkedHashSet<GroovyClassDoc>();
         Class[] interfaces = d.externalClass().getInterfaces();
         if (interfaces != null) {
             for (Class i : interfaces) {
@@ -858,7 +858,7 @@ public class SimpleGroovyClassDoc extends SimpleGroovyAbstractableElementDoc
imp
         Matcher matcher = regex.matcher(self + "@endMarker");
         if (matcher.find()) {
             matcher.reset();
-            Map<String, List<String>> savedTags = new HashMap<String, List<String>>();
+            Map<String, List<String>> savedTags = new LinkedHashMap<String,
List<String>>();
             StringBuffer sb = new StringBuffer();
             while (matcher.find()) {
                 String tagname = matcher.group(1);

http://git-wip-us.apache.org/repos/asf/groovy/blob/752d06f3/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
index dc0a524..0901dca 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
@@ -59,8 +59,8 @@ public class SimpleGroovyClassDocAssembler extends VisitorAdapter implements
Gro
         this.isGroovy = isGroovy;
 
         stack = new Stack<GroovySourceAST>();
-        classDocs = new HashMap<String, GroovyClassDoc>();
         className = file;
+        classDocs = new LinkedHashMap<String, GroovyClassDoc>();
         if (file != null) {
             // todo: replace this simple idea of default class name
             int idx = file.lastIndexOf(".");
@@ -69,7 +69,7 @@ public class SimpleGroovyClassDocAssembler extends VisitorAdapter implements
Gro
 
         deferSetup = packagePath.equals("DefaultPackage");
         importedClassesAndPackages = new ArrayList<String>();
-        aliases = new HashMap<String, String>();
+        aliases = new LinkedHashMap<String, String>();
         if (!deferSetup) setUpImports(packagePath, links, isGroovy, className);
         lastLineCol = new LineColumn(1, 1);
     }
@@ -127,7 +127,7 @@ public class SimpleGroovyClassDocAssembler extends VisitorAdapter implements
Gro
             if (parent != null && isNested() && !insideAnonymousInnerClass())
{
                 className = parent.name() + "." + className;
             } else {
-                foundClasses = new HashMap<String, SimpleGroovyClassDoc>();
+                foundClasses = new LinkedHashMap<String, SimpleGroovyClassDoc>();
             }
             SimpleGroovyClassDoc current = (SimpleGroovyClassDoc) classDocs.get(packagePath
+ FS + className);
             if (current == null) {
@@ -272,7 +272,7 @@ public class SimpleGroovyClassDocAssembler extends VisitorAdapter implements
Gro
             }
             classDocs.put(currentClassDoc.getFullPathName(), currentClassDoc);
             if (foundClasses == null) {
-                foundClasses = new HashMap<String, SimpleGroovyClassDoc>();
+                foundClasses = new LinkedHashMap<String, SimpleGroovyClassDoc>();
             }
             foundClasses.put(className, currentClassDoc);
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/752d06f3/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
index e4af6a3..89c5bcd 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyRootDoc.java
@@ -24,7 +24,7 @@ import org.codehaus.groovy.groovydoc.GroovyRootDoc;
 
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -37,8 +37,8 @@ public class SimpleGroovyRootDoc extends SimpleGroovyDoc implements GroovyRootDo
 
     public SimpleGroovyRootDoc(String name) {
         super(name);
-        packageDocs = new HashMap<String, GroovyPackageDoc>();
-        classDocs = new HashMap<String, GroovyClassDoc>();
+        packageDocs = new LinkedHashMap<String, GroovyPackageDoc>();
+        classDocs = new LinkedHashMap<String, GroovyClassDoc>();
     }
 
     public GroovyClassDoc classNamed(GroovyClassDoc groovyClassDoc, String name) {
@@ -119,7 +119,7 @@ public class SimpleGroovyRootDoc extends SimpleGroovyDoc implements GroovyRootDo
     }
 
     public Map<String, GroovyClassDoc> getVisibleClasses(List importedClassesAndPackages)
{
-        Map<String, GroovyClassDoc> visibleClasses = new HashMap<String, GroovyClassDoc>();
+        Map<String, GroovyClassDoc> visibleClasses = new LinkedHashMap<String, GroovyClassDoc>();
         for (String fullClassName : classDocs.keySet()) {
             String equivalentPackageImport = fullClassName.replaceAll("[^/]+$", "*");
             if (importedClassesAndPackages.contains(fullClassName) ||


Mime
View raw message