[2/2] groovy git commit: minor refactor

2018-08-19 Thread paulk
minor refactor


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 4b4a286e0305de3e88cfbe86f796aa3ca5a1a621
Parents: 50256d8
Author: Paul King 
Authored: Fri Aug 17 17:39:10 2018 +1000
Committer: Paul King 
Committed: Sun Aug 19 17:01:36 2018 +1000

--
 gradle/pomconfigurer.gradle | 3 +++
 src/main/java/org/codehaus/groovy/runtime/ConvertedClosure.java | 4 
 2 files changed, 3 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/4b4a286e/gradle/pomconfigurer.gradle
--
diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle
index 68670f1..681b012 100644
--- a/gradle/pomconfigurer.gradle
+++ b/gradle/pomconfigurer.gradle
@@ -636,6 +636,9 @@ project.ext.pomConfigureClosureWithoutTweaks = {
 contributor {
 name 'Shruti Gupta'
 }
+contributor {
+name 'Ben Yu'
+}
 }
 mailingLists {
 mailingList {

http://git-wip-us.apache.org/repos/asf/groovy/blob/4b4a286e/src/main/java/org/codehaus/groovy/runtime/ConvertedClosure.java
--
diff --git a/src/main/java/org/codehaus/groovy/runtime/ConvertedClosure.java 
b/src/main/java/org/codehaus/groovy/runtime/ConvertedClosure.java
index dfc7ea0..84a627f 100644
--- a/src/main/java/org/codehaus/groovy/runtime/ConvertedClosure.java
+++ b/src/main/java/org/codehaus/groovy/runtime/ConvertedClosure.java
@@ -25,10 +25,6 @@ import java.lang.reflect.Method;
 
 /**
  * This class is a general adapter to adapt a closure to any Java interface.
- * 
- * @author Ben Yu
- * @author mailto:blackd...@gmx.org";>Jochen Theodorou
- * Jul 27, 2006 3:50:51 PM
  */
 public class ConvertedClosure extends ConversionHandler implements 
Serializable {
 private final String methodName;



[2/2] groovy git commit: minor refactor: move some tests into their respective modules

2018-07-08 Thread paulk
minor refactor: move some tests into their respective modules


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

Branch: refs/heads/master
Commit: 26cacfc79882e081d079e9aea2165cf9ef6d0af2
Parents: 040e8a0
Author: Paul King 
Authored: Mon Jul 9 15:22:21 2018 +1000
Committer: Paul King 
Committed: Mon Jul 9 16:31:04 2018 +1000

--
 .../groovy/bugs/groovy4585/groovy4585.xml   |  32 -
 .../groovy/bugs/groovy4585/Groovy4585Bug.groovy |  31 -
 src/test/groovy/tree/NavigationNodeTest.groovy  |  58 ++
 src/test/groovy/tree/NavigationTest.groovy  | 116 ---
 .../groovy/util/DelegatingScriptTest.groovy |  58 +-
 .../groovy/bugs/groovy4585/Groovy4585Bug.groovy |  31 +
 .../resources/bugs/groovy4585/groovy4585.xml|  32 +
 .../groovy/groovy/tree/NavigationXmlTest.groovy |  86 ++
 8 files changed, 237 insertions(+), 207 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/26cacfc7/src/test-resources/groovy/bugs/groovy4585/groovy4585.xml
--
diff --git a/src/test-resources/groovy/bugs/groovy4585/groovy4585.xml 
b/src/test-resources/groovy/bugs/groovy4585/groovy4585.xml
deleted file mode 100644
index 6dcf2bb..000
--- a/src/test-resources/groovy/bugs/groovy4585/groovy4585.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-<%for (int i = 0; i < names.size(); i++) {%>
-
-  
-
-<%}%>
-
-

http://git-wip-us.apache.org/repos/asf/groovy/blob/26cacfc7/src/test/groovy/bugs/groovy4585/Groovy4585Bug.groovy
--
diff --git a/src/test/groovy/bugs/groovy4585/Groovy4585Bug.groovy 
b/src/test/groovy/bugs/groovy4585/Groovy4585Bug.groovy
deleted file mode 100644
index 0dc274c..000
--- a/src/test/groovy/bugs/groovy4585/Groovy4585Bug.groovy
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package groovy.bugs.groovy4585
-
-class Groovy4585Bug extends GroovyTestCase {
-void test() {
-def engineForBuildXml = new groovy.text.SimpleTemplateEngine(false)
-engineForBuildXml.setEscapeBackslash(true)
-def templateForBuildXml = 
engineForBuildXml.createTemplate(this.getClass().getResource("/groovy/bugs/groovy4585/groovy4585.xml").text)
-String buildXmlContent = templateForBuildXml.make([names:['a', 'b', 
'c']]).toString()
-
-assert buildXmlContent.contains('')
-assert buildXmlContent.contains('')
-}
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/26cacfc7/src/test/groovy/tree/NavigationNodeTest.groovy
--
diff --git a/src/test/groovy/tree/NavigationNodeTest.groovy 
b/src/test/groovy/tree/NavigationNodeTest.groovy
new file mode 100644
index 000..2ff997d
--- /dev/null
+++ b/src/test/groovy/tree/NavigationNodeTest.groovy
@@ -0,0 +1,58 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package groovy.tree

[2/2] groovy git commit: minor refactor

2017-11-22 Thread paulk
minor refactor


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 8e2e942fea6511ddb87a9927b73cd7c27ce3c0bb
Parents: e28d031
Author: paulk 
Authored: Thu Nov 23 07:55:06 2017 +1000
Committer: paulk 
Committed: Thu Nov 23 13:02:13 2017 +1000

--
 gradle/pomconfigurer.gradle |  3 ++
 .../groovy/jmx/builder/JmxTimerFactory.groovy   | 56 ++--
 .../jmx/builder/JmxTimerFactoryTest.groovy  |  3 --
 3 files changed, 31 insertions(+), 31 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/8e2e942f/gradle/pomconfigurer.gradle
--
diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle
index 197dc42..07e38db 100644
--- a/gradle/pomconfigurer.gradle
+++ b/gradle/pomconfigurer.gradle
@@ -588,6 +588,9 @@ project.ext.pomConfigureClosureWithoutTweaks = {
 contributor {
 name 'Stephane Landelle'
 }
+contributor {
+name 'Vladimir Vivien'
+}
 }
 mailingLists {
 mailingList {

http://git-wip-us.apache.org/repos/asf/groovy/blob/8e2e942f/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxTimerFactory.groovy
--
diff --git 
a/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxTimerFactory.groovy
 
b/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxTimerFactory.groovy
index 934ead2..6b51bf7 100644
--- 
a/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxTimerFactory.groovy
+++ 
b/subprojects/groovy-jmx/src/main/groovy/groovy/jmx/builder/JmxTimerFactory.groovy
@@ -39,8 +39,6 @@ import javax.management.ObjectName
  * occurences:long
  * )
  * 
- *
- * @author Vladimir Vivien
  */
 class JmxTimerFactory extends AbstractFactory {
 public Object newInstance(FactoryBuilderSupport builder, Object nodeName, 
Object nodeParam, Map nodeAttribs) {
@@ -67,10 +65,10 @@ class JmxTimerFactory extends AbstractFactory {
 metaMap.listeners = getNormalizedRecipientList(metaMap.listeners)
 
 def result = registerTimer(metaMap)
-return result
+result
 }
 
-private def getNormalizedName(fsb, timer, name) {
+private static getNormalizedName(fsb, timer, name) {
 def result
 if (!name) {
 result = getDefaultName(fsb, timer)
@@ -80,18 +78,18 @@ class JmxTimerFactory extends AbstractFactory {
 } else if (name instanceof ObjectName) {
 result = name
 } else {
-result = getDefaultName(fsb, time)
+result = getDefaultName(fsb, timer)
 }
 }
-return result
+result
 }
 
-private def getDefaultName(fsb, timer) {
+private static getDefaultName(fsb, timer) {
 def name = 
"${fsb.getDefaultJmxNameDomain()}:type=TimerService,name=Timer@${timer.hashCode()}"
-return new ObjectName(name)
+new ObjectName(name)
 }
 
-private def getNormalizedDate(date) {
+private static getNormalizedDate(date) {
 if (!date) return new Date()
 if (date instanceof Date) {
 return date
@@ -103,10 +101,10 @@ class JmxTimerFactory extends AbstractFactory {
 default:
 startDate = new Date()
 }
-return startDate
+startDate
 }
 
-private def getNormalizedPeriod(period) {
+private static getNormalizedPeriod(period) {
 if (!period) return 1000L
 if (period instanceof Number) {
 return period
@@ -117,8 +115,9 @@ class JmxTimerFactory extends AbstractFactory {
 def value
 try {
 value = period[0..-2].toLong()
-} catch (e) {
+} catch (ignore) {
 multiplier = "x"
+value = 0
 }
 switch (multiplier) {
 case "s":
@@ -137,28 +136,29 @@ class JmxTimerFactory extends AbstractFactory {
 result = 1000L
 }
 }
-return result
+result
 }
 
-private def getNormalizedRecipientList(list) {
+private static getNormalizedRecipientList(list) {
 if (!list) return null
 def result = []
 
-list.each {name ->
+list.each { name ->
 def on
 if (name instanceof String) {
 on = new ObjectName(name)
-}
-if (name instanceof ObjectName) {
+} else 

[2/2] groovy git commit: minor refactor: a little more consistency around how -Dname=value system properties are set

2017-10-12 Thread paulk
minor refactor: a little more consistency around how -Dname=value system 
properties are set


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

Branch: refs/heads/GROOVY_2_5_X
Commit: ff5d63f913d1f81ac150456b0b8083b41fc30530
Parents: 03935c9
Author: paulk 
Authored: Thu Oct 12 18:19:53 2017 +1000
Committer: paulk 
Committed: Thu Oct 12 18:21:26 2017 +1000

--
 src/main/groovy/ui/GroovyMain.java  | 60 +++-
 src/main/org/apache/groovy/util/SystemUtil.java | 46 +++
 .../org/codehaus/groovy/tools/GrapeMain.groovy  | 10 ++--
 .../groovy/tools/LoaderConfiguration.java   | 12 ++--
 .../org/codehaus/groovy/tools/shell/Main.groovy | 29 +++---
 5 files changed, 82 insertions(+), 75 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/ff5d63f9/src/main/groovy/ui/GroovyMain.java
--
diff --git a/src/main/groovy/ui/GroovyMain.java 
b/src/main/groovy/ui/GroovyMain.java
index 0fdd696..9cb973d 100644
--- a/src/main/groovy/ui/GroovyMain.java
+++ b/src/main/groovy/ui/GroovyMain.java
@@ -46,18 +46,16 @@ import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Properties;
 import java.util.regex.Pattern;
 
 import static org.apache.commons.cli.Option.builder;
 
 /**
  * A Command line to execute groovy.
- *
- * @author Jeremy Rayner
- * @author Yuri Schimke
- * @author Roshan Dawrani
  */
 public class GroovyMain {
 
@@ -178,49 +176,30 @@ public class GroovyMain {
 return new Options()
 
.addOption(builder("classpath").hasArg().argName("path").desc("Specify where to 
find the class files - must be first argument").build())
 
.addOption(builder("cp").longOpt("classpath").hasArg().argName("path").desc("Aliases
 for '-classpath'").build())
-.addOption(builder("D").longOpt("define").desc("define a 
system property").hasArg().argName("name=value").build())
+.addOption(builder("D").longOpt("define").desc("Define a 
system 
property").numberOfArgs(2).valueSeparator().argName("name=value").build())
 .addOption(
 builder().longOpt("disableopt")
-.desc("disables one or all optimization 
elements. " +
+.desc("Disables one or all optimization 
elements; " +
 "optlist can be a comma separated list 
with the elements: " +
 "all (disables all optimizations), " +
 "int (disable any int based 
optimizations)")
 .hasArg().argName("optlist").build())
-.addOption(builder("h").hasArg(false).desc("usage 
information").longOpt("help").build())
-.addOption(builder("d").hasArg(false).desc("debug mode will 
print out full stack traces").longOpt("debug").build())
-.addOption(builder("v").hasArg(false).desc("display the Groovy 
and JVM versions").longOpt("version").build())
-
.addOption(builder("c").argName("charset").hasArg().desc("specify the encoding 
of the files").longOpt("encoding").build())
-
.addOption(builder("e").argName("script").hasArg().desc("specify a command line 
script").build())
-
.addOption(builder("i").argName("extension").optionalArg(true).desc("modify 
files in place; create backup if extension is given (e.g. \'.bak\')").build())
-.addOption(builder("n").hasArg(false).desc("process files line 
by line using implicit 'line' variable").build())
-.addOption(builder("p").hasArg(false).desc("process files line 
by line and print result (see also -n)").build())
+.addOption(builder("h").hasArg(false).desc("Usage 
information").longOpt("help").build())
+.addOption(builder("d").hasArg(false).desc("Debug mode will 
print out full stack traces").longOpt("debug").build())
+.addOption(builder("v").hasArg(false).desc("Display the Groovy 
and JVM versions").longOpt("version").build())
+
.addOption(builder("c").argName("charset").hasArg().desc("Specify the encoding 
of the files").longOpt("encoding").build())
+
.addOption(builder("e").argName("script").hasArg().desc("Specify a command line 
script").build())
+
.addOption(builder("i").argName("extension").o

[2/2] groovy git commit: minor refactor

2017-09-29 Thread paulk
minor refactor


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 4888769de12d760e644c58a79417534fc2362b6f
Parents: f56a9b5
Author: paulk 
Authored: Wed Sep 27 22:01:49 2017 +1000
Committer: paulk 
Committed: Fri Sep 29 22:50:15 2017 +1000

--
 .../codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/4888769d/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
--
diff --git 
a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java 
b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
index aed8f01..f410f71 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -1992,7 +1992,7 @@ public class StaticTypeCheckingVisitor extends 
ClassCodeVisitorSupport {
 List classNodes = getTemporaryTypesForExpression(exp);
 if (classNodes != null && !classNodes.isEmpty()) {
 ArrayList arr = new 
ArrayList(classNodes.size() + 1);
-if (result != null) arr.add(result);
+if (result != null && !classNodes.contains(result)) 
arr.add(result);
 arr.addAll(classNodes);
 // GROOVY-7333: filter out Object
 Iterator iterator = arr.iterator();



[2/2] groovy git commit: minor refactor for build

2017-09-12 Thread paulk
minor refactor for build


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

Branch: refs/heads/master
Commit: 26fc4e0f2b3ac6bb26660899f6d2e8b1daee39ce
Parents: a9a8d52
Author: paulk 
Authored: Wed Sep 13 12:49:25 2017 +1000
Committer: paulk 
Committed: Wed Sep 13 16:17:05 2017 +1000

--
 build.gradle|  5 +
 gradle/assemble.gradle  | 10 -
 gradle/docs.gradle  |  2 +-
 .../META-INF/groovy-release-info.properties | 23 
 .../org.codehaus.groovy.source.Extensions   | 22 ---
 codehaus.groovy.transform.ASTTransformation | 20 -
 .../META-INF/groovy-release-info.properties | 23 
 .../org.codehaus.groovy.source.Extensions   | 22 +++
 codehaus.groovy.transform.ASTTransformation | 20 +
 9 files changed, 71 insertions(+), 76 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/26fc4e0f/build.gradle
--
diff --git a/build.gradle b/build.gradle
index 1de344a..1bf8f47 100644
--- a/build.gradle
+++ b/build.gradle
@@ -287,10 +287,7 @@ sourceSets {
 }
 }
 resources {
-srcDirs = ['src/main', 'src/resources']
-include 'META-INF/services/*',
-'META-INF/groovy-release-info.properties',
-'groovy/grape/*.xml'
+srcDirs = ['src/resources']
 }
 }
 test {

http://git-wip-us.apache.org/repos/asf/groovy/blob/26fc4e0f/gradle/assemble.gradle
--
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 3fdfd31..b6581c4 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -141,14 +141,12 @@ jar {
 include('antlr2-license.txt')
 }
 from("$projectDir/notices/NOTICE-JARJAR")
-from('src/main/META-INF/groovy-release-info.properties') {
+from('src/resources/META-INF/groovy-release-info.properties') {
 filter(rootProject.propertiesFilter, 
org.apache.tools.ant.filters.ReplaceTokens)
 }
 rename { String filename -> filename == 'LICENSE-JARJAR' ? 'LICENSE' : 
filename == 'NOTICE-JARJAR' ? 'NOTICE' : filename }
 }
-
-exclude '**/package-info.class', 'META-INF/groovy-release-info.properties'
-
+exclude '**/package-info.class'
 }
 
 allprojects {
@@ -276,12 +274,12 @@ subprojects { sp ->
 } else {
 from "${rootProject.projectDir}/notices/NOTICE-BASE"
 }
-
from("${rootProject.projectDir}/src/main/META-INF/groovy-release-info.properties")
 {
+
from("${rootProject.projectDir}/src/resources/META-INF/groovy-release-info.properties")
 {
 filter(rootProject.propertiesFilter, 
org.apache.tools.ant.filters.ReplaceTokens)
 }
 rename { String filename -> filename == 'LICENSE-BASE' ? 'LICENSE' 
: filename == 'NOTICE-BASE' ? 'NOTICE' : filename }
 }
-exclude '**/package-info.class', 
'META-INF/groovy-release-info.properties'
+exclude '**/package-info.class'
 }
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/26fc4e0f/gradle/docs.gradle
--
diff --git a/gradle/docs.gradle b/gradle/docs.gradle
index 905d06a..f9992ba 100644
--- a/gradle/docs.gradle
+++ b/gradle/docs.gradle
@@ -114,7 +114,7 @@ groovydocAll groovydocSpec
 task docProjectVersionInfo(type: Copy) {
 destinationDir = 
file("${project(':groovy-docgenerator').buildDir}/classes/main")
 into('META-INF') {
-from('src/main/META-INF/groovy-release-info.properties') {
+from('src/resources/META-INF/groovy-release-info.properties') {
 filter(rootProject.propertiesFilter, 
org.apache.tools.ant.filters.ReplaceTokens)
 }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/26fc4e0f/src/main/META-INF/groovy-release-info.properties
--
diff --git a/src/main/META-INF/groovy-release-info.properties 
b/src/main/META-INF/groovy-release-info.properties
deleted file mode 100644
index 7eae8ae..000
--- a/src/main/META-INF/groovy-release-info.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-#  Licensed to the Apache Software Foundation (ASF) under one
-#  or more contributor license agreements.  See the NOTICE file
-#  distributed with this work for additional information
-

[2/2] groovy git commit: minor refactor

2016-05-31 Thread paulk
minor refactor


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 036c14fa0ecc883ccc3b931aef40a666e374ed22
Parents: df63a38
Author: paulk 
Authored: Wed Jun 1 13:35:39 2016 +1000
Committer: paulk 
Committed: Wed Jun 1 13:47:09 2016 +1000

--
 src/main/org/codehaus/groovy/ast/ClassNode.java | 45 
 .../groovy/ast/tools/ClassNodeUtils.java| 41 ++
 .../groovy/ast/tools/ParameterUtils.java| 39 +
 .../classgen/ClassCompletionVerifier.java   |  3 +-
 .../groovy/classgen/ExtendedVerifier.java   | 19 +
 .../classgen/asm/OptimizingStatementWriter.java | 18 +---
 6 files changed, 103 insertions(+), 62 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/036c14fa/src/main/org/codehaus/groovy/ast/ClassNode.java
--
diff --git a/src/main/org/codehaus/groovy/ast/ClassNode.java 
b/src/main/org/codehaus/groovy/ast/ClassNode.java
index faf4570..6306f5f 100644
--- a/src/main/org/codehaus/groovy/ast/ClassNode.java
+++ b/src/main/org/codehaus/groovy/ast/ClassNode.java
@@ -24,9 +24,11 @@ import org.codehaus.groovy.ast.expr.Expression;
 import org.codehaus.groovy.ast.expr.FieldExpression;
 import org.codehaus.groovy.ast.expr.MapExpression;
 import org.codehaus.groovy.ast.expr.TupleExpression;
+import org.codehaus.groovy.ast.stmt.BlockStatement;
 import org.codehaus.groovy.ast.stmt.ExpressionStatement;
 import org.codehaus.groovy.ast.stmt.Statement;
-import org.codehaus.groovy.ast.stmt.BlockStatement;
+import org.codehaus.groovy.ast.tools.ClassNodeUtils;
+import org.codehaus.groovy.ast.tools.ParameterUtils;
 import org.codehaus.groovy.control.CompilePhase;
 import org.codehaus.groovy.transform.ASTTransformation;
 import org.codehaus.groovy.transform.GroovyASTTransformation;
@@ -34,8 +36,18 @@ import org.codehaus.groovy.vmplugin.VMPluginFactory;
 import org.objectweb.asm.Opcodes;
 
 import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * Represents a class in the AST.
@@ -435,7 +447,7 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 } else {
 result = new HashMap();
 }
-addInterfaceMethods(result);
+ClassNodeUtils.addInterfaceMethods(this, result);
 
 // And add in the methods implemented in this class.
 for (MethodNode method : getMethods()) {
@@ -445,19 +457,6 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 return result;
 }
 
-public void addInterfaceMethods(Map methodsMap) {
-// add in unimplemented abstract methods from the interfaces
-for (ClassNode iface : getInterfaces()) {
-Map ifaceMethodsMap = 
iface.getDeclaredMethodsMap();
-for (String methSig : ifaceMethodsMap.keySet()) {
-if (!methodsMap.containsKey(methSig)) {
-MethodNode methNode = ifaceMethodsMap.get(methSig);
-methodsMap.put(methSig, methNode);
-}
-}
-}
-}
-
 public String getName() {
 return redirect().name;
 }
@@ -1039,17 +1038,7 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
  * @return true if the two arrays are of the same size and have the same 
contents
  */
 protected boolean parametersEqual(Parameter[] a, Parameter[] b) {
-if (a.length == b.length) {
-boolean answer = true;
-for (int i = 0; i < a.length; i++) {
-if (!a[i].getType().equals(b[i].getType())) {
-answer = false;
-break;
-}
-}
-return answer;
-}
-return false;
+return ParameterUtils.parametersEqual(a, b);
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/036c14fa/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java
--
diff --git a/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java 
b/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java
new file mode 100644
index 000..f3eec90
--- /dev/null
+++ b/src/main/org/

[2/2] groovy git commit: minor refactor

2016-05-31 Thread paulk
minor refactor


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

Branch: refs/heads/master
Commit: 3d60dbd796c6b362c8c590b14c247b9769a8edbf
Parents: 973197f
Author: paulk 
Authored: Wed Jun 1 13:35:39 2016 +1000
Committer: paulk 
Committed: Wed Jun 1 13:35:39 2016 +1000

--
 src/main/org/codehaus/groovy/ast/ClassNode.java | 29 ++
 .../groovy/ast/tools/ClassNodeUtils.java| 41 
 .../groovy/ast/tools/ParameterUtils.java| 39 +++
 .../classgen/ClassCompletionVerifier.java   |  3 +-
 .../groovy/classgen/ExtendedVerifier.java   | 19 +
 .../classgen/asm/OptimizingStatementWriter.java | 18 +
 6 files changed, 90 insertions(+), 59 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/3d60dbd7/src/main/org/codehaus/groovy/ast/ClassNode.java
--
diff --git a/src/main/org/codehaus/groovy/ast/ClassNode.java 
b/src/main/org/codehaus/groovy/ast/ClassNode.java
index 68ac22d..37ad787 100644
--- a/src/main/org/codehaus/groovy/ast/ClassNode.java
+++ b/src/main/org/codehaus/groovy/ast/ClassNode.java
@@ -23,6 +23,8 @@ import org.codehaus.groovy.ast.expr.*;
 import org.codehaus.groovy.ast.stmt.BlockStatement;
 import org.codehaus.groovy.ast.stmt.ExpressionStatement;
 import org.codehaus.groovy.ast.stmt.Statement;
+import org.codehaus.groovy.ast.tools.ClassNodeUtils;
+import org.codehaus.groovy.ast.tools.ParameterUtils;
 import org.codehaus.groovy.control.CompilePhase;
 import org.codehaus.groovy.transform.ASTTransformation;
 import org.codehaus.groovy.transform.GroovyASTTransformation;
@@ -431,7 +433,7 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 } else {
 result = new HashMap();
 }
-addInterfaceMethods(result);
+ClassNodeUtils.addInterfaceMethods(this, result);
 
 // And add in the methods implemented in this class.
 for (MethodNode method : getMethods()) {
@@ -441,19 +443,6 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 return result;
 }
 
-public void addInterfaceMethods(Map methodsMap) {
-// add in unimplemented abstract methods from the interfaces
-for (ClassNode iface : getInterfaces()) {
-Map ifaceMethodsMap = 
iface.getDeclaredMethodsMap();
-for (String methSig : ifaceMethodsMap.keySet()) {
-if (!methodsMap.containsKey(methSig)) {
-MethodNode methNode = ifaceMethodsMap.get(methSig);
-methodsMap.put(methSig, methNode);
-}
-}
-}
-}
-
 public String getName() {
 return redirect().name;
 }
@@ -1047,17 +1036,7 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
  * @return true if the two arrays are of the same size and have the same 
contents
  */
 protected boolean parametersEqual(Parameter[] a, Parameter[] b) {
-if (a.length == b.length) {
-boolean answer = true;
-for (int i = 0; i < a.length; i++) {
-if (!a[i].getType().equals(b[i].getType())) {
-answer = false;
-break;
-}
-}
-return answer;
-}
-return false;
+return ParameterUtils.parametersEqual(a, b);
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/3d60dbd7/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java
--
diff --git a/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java 
b/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java
new file mode 100644
index 000..f3eec90
--- /dev/null
+++ b/src/main/org/codehaus/groovy/ast/tools/ClassNodeUtils.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * spec