[04/10] groovy git commit: Fix misprint in javadoc for href attribute (closes #481)

2017-01-28 Thread sunlan
Fix misprint in javadoc for href attribute (closes #481)

See RFC-2368 (https://tools.ietf.org/html/rfc2368).
The right scheme for  mailtoURL  is  "mailto:; [ to ] [ headers ]


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

Branch: refs/heads/parrot
Commit: 11c37114d740efd5223814cf7e6758a98e83e4de
Parents: 186e77e
Author: Alykoff 
Authored: Thu Jan 26 22:52:04 2017 +0300
Committer: paulk 
Committed: Fri Jan 27 15:21:03 2017 +1000

--
 src/main/org/codehaus/groovy/ast/ASTNode.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/11c37114/src/main/org/codehaus/groovy/ast/ASTNode.java
--
diff --git a/src/main/org/codehaus/groovy/ast/ASTNode.java 
b/src/main/org/codehaus/groovy/ast/ASTNode.java
index c6d238d..058af78 100644
--- a/src/main/org/codehaus/groovy/ast/ASTNode.java
+++ b/src/main/org/codehaus/groovy/ast/ASTNode.java
@@ -44,7 +44,7 @@ import java.util.Map;
  * 
  *
  * @author mailto:ja...@coredevelopers.net;>James Strachan
- * @author Jochen "blackdrag" Theodorou
+ * @author mailto:blackd...@gmx.org;>Jochen "blackdrag" Theodorou
  */
 public class ASTNode {
 



[03/10] groovy git commit: GROOVY-8023: removing empty method

2017-01-28 Thread sunlan
GROOVY-8023: removing empty method


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

Branch: refs/heads/parrot
Commit: 186e77eb1250f0a9c67f98d02cf2c94732b1b506
Parents: d3dd694
Author: Jochen Theodorou 
Authored: Thu Jan 26 21:03:42 2017 +0100
Committer: Jochen Theodorou 
Committed: Thu Jan 26 21:03:42 2017 +0100

--
 .../transform/trait/SuperCallTraitTransformer.java  | 12 
 1 file changed, 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/186e77eb/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
--
diff --git 
a/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java 
b/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
index 6ebc5f2..f3d35d8 100644
--- 
a/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
+++ 
b/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
@@ -141,18 +141,6 @@ class SuperCallTraitTransformer extends 
ClassCodeExpressionTransformer {
 return super.transform(exp);
 }
 
-private Expression transformPropertyExpression(final PropertyExpression 
expression) {
-Expression objectExpression = expression.getObjectExpression();
-ClassNode type = objectExpression.getType();
-if (objectExpression instanceof ClassExpression) {
-if (Traits.isTrait(type) && 
"super".equals(expression.getPropertyAsString())) {
-// SomeTrait.super --> annotate to recognize later
-expression.putNodeMetaData(SuperCallTraitTransformer.class, 
type);
-}
-}
-return super.transform(expression);
-}
-
 private boolean isTraitSuperPropertyExpression(Expression exp) {
 if (exp instanceof PropertyExpression) {
 PropertyExpression pexp = (PropertyExpression) exp;



[02/10] groovy git commit: GROOVY-8023: changing O(n^2) time complexity of transformMethodCall in SuperCallTraitTransformer to O(n)

2017-01-28 Thread sunlan
GROOVY-8023: changing O(n^2) time complexity of transformMethodCall in 
SuperCallTraitTransformer to O(n)


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

Branch: refs/heads/parrot
Commit: d3dd694969e85050b2b127280ad5ca7dcdfd2180
Parents: e96a961
Author: Jochen Theodorou 
Authored: Thu Jan 26 21:01:35 2017 +0100
Committer: Jochen Theodorou 
Committed: Thu Jan 26 21:01:35 2017 +0100

--
 .../trait/SuperCallTraitTransformer.java| 40 ++--
 .../codehaus/groovy/transform/trait/Traits.java |  2 +-
 2 files changed, 29 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/d3dd6949/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
--
diff --git 
a/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java 
b/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
index e403a2c..6ebc5f2 100644
--- 
a/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
+++ 
b/src/main/org/codehaus/groovy/transform/trait/SuperCallTraitTransformer.java
@@ -19,6 +19,7 @@
 package org.codehaus.groovy.transform.trait;
 
 import groovy.lang.MetaProperty;
+import java.util.List;
 import org.codehaus.groovy.ast.ClassCodeExpressionTransformer;
 import org.codehaus.groovy.ast.ClassNode;
 import org.codehaus.groovy.ast.MethodNode;
@@ -34,8 +35,6 @@ import org.codehaus.groovy.ast.expr.VariableExpression;
 import org.codehaus.groovy.control.SourceUnit;
 import org.codehaus.groovy.syntax.Types;
 
-import java.util.List;
-
 /**
  * This transformer is used to transform calls to 
SomeTrait.super.foo() into the appropriate trait call.
  *
@@ -56,9 +55,6 @@ class SuperCallTraitTransformer extends 
ClassCodeExpressionTransformer {
 
 @Override
 public Expression transform(final Expression exp) {
-if (exp instanceof PropertyExpression) {
-return transformPropertyExpression((PropertyExpression) exp);
-}
 if (exp instanceof MethodCallExpression) {
 return transformMethodCallExpression((MethodCallExpression)exp);
 }
@@ -74,12 +70,17 @@ class SuperCallTraitTransformer extends 
ClassCodeExpressionTransformer {
 BinaryExpression bin = (BinaryExpression) trn;
 Expression leftExpression = bin.getLeftExpression();
 if (bin.getOperation().getType() == Types.EQUAL && leftExpression 
instanceof PropertyExpression) {
-ClassNode traitReceiver = ((PropertyExpression) 
leftExpression).getObjectExpression().getNodeMetaData(SuperCallTraitTransformer.class);
+ClassNode traitReceiver = null;
+PropertyExpression leftPropertyExpression = 
(PropertyExpression) leftExpression;
+if 
(isTraitSuperPropertyExpression(leftPropertyExpression.getObjectExpression())) {
+PropertyExpression pexp = (PropertyExpression) 
leftPropertyExpression.getObjectExpression();
+traitReceiver = pexp.getObjectExpression().getType();
+}
 if (traitReceiver!=null) {
 // A.super.foo = ...
 TraitHelpersTuple helpers = 
Traits.findHelpers(traitReceiver);
 ClassNode helper = helpers.getHelper();
-String setterName = 
MetaProperty.getSetterName(((PropertyExpression) 
leftExpression).getPropertyAsString());
+String setterName = 
MetaProperty.getSetterName(leftPropertyExpression.getPropertyAsString());
 List methods = helper.getMethods(setterName);
 for (MethodNode method : methods) {
 Parameter[] parameters = method.getParameters();
@@ -106,9 +107,10 @@ class SuperCallTraitTransformer extends 
ClassCodeExpressionTransformer {
 }
 
 private Expression transformMethodCallExpression(final 
MethodCallExpression exp) {
-Expression objectExpression = transform(exp.getObjectExpression());
-ClassNode traitReceiver = 
objectExpression.getNodeMetaData(SuperCallTraitTransformer.class);
-if (traitReceiver!=null) {
+if (isTraitSuperPropertyExpression(exp.getObjectExpression())) {
+Expression objectExpression = exp.getObjectExpression();
+ClassNode traitReceiver = ((PropertyExpression) 
objectExpression).getObjectExpression().getType();
+
 TraitHelpersTuple helpers = Traits.findHelpers(traitReceiver);
 // (SomeTrait.super).foo() --> 

[01/10] groovy git commit: GROOVY-8060: @Log annotation does not check logging enablement inside closures which are arguments to methods

2017-01-28 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/parrot a033231e2 -> 5392eb4fa


GROOVY-8060: @Log annotation does not check logging enablement inside closures 
which are arguments to methods


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

Branch: refs/heads/parrot
Commit: e96a9619ca3e51d867290056194fe5259c55c084
Parents: 90fe6d2
Author: paulk 
Authored: Mon Jan 23 21:42:52 2017 +1000
Committer: paulk 
Committed: Mon Jan 23 21:42:52 2017 +1000

--
 .../groovy/transform/LogASTTransformation.java  | 24 +++-
 src/test/groovy/bugs/Groovy8060Bug.groovy   | 39 
 2 files changed, 54 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/e96a9619/src/main/org/codehaus/groovy/transform/LogASTTransformation.java
--
diff --git a/src/main/org/codehaus/groovy/transform/LogASTTransformation.java 
b/src/main/org/codehaus/groovy/transform/LogASTTransformation.java
index 42fb9a3..ecf92bc 100644
--- a/src/main/org/codehaus/groovy/transform/LogASTTransformation.java
+++ b/src/main/org/codehaus/groovy/transform/LogASTTransformation.java
@@ -129,24 +129,30 @@ public class LogASTTransformation extends 
AbstractASTTransformation implements C
 }
 
 private Expression transformMethodCallExpression(Expression exp) {
-MethodCallExpression mce = (MethodCallExpression) exp;
+Expression modifiedCall = addGuard((MethodCallExpression) exp);
+return modifiedCall == null ? super.transform(exp) : 
modifiedCall;
+}
+
+private Expression addGuard(MethodCallExpression mce) {
+// only add guard to methods of the form: 
logVar.logMethod(params)
 if (!(mce.getObjectExpression() instanceof 
VariableExpression)) {
-return exp;
+return null;
 }
 VariableExpression variableExpression = (VariableExpression) 
mce.getObjectExpression();
 if (!variableExpression.getName().equals(logFieldName)
 || !(variableExpression.getAccessedVariable() 
instanceof DynamicVariable)) {
-return exp;
+return null;
 }
+
 String methodName = mce.getMethodAsString();
-if (methodName == null) return exp;
-if (usesSimpleMethodArgumentsOnly(mce)) return exp;
+if (methodName == null) return null;
+if (!loggingStrategy.isLoggingMethod(methodName)) return null;
+// also don't bother with guard if we have "simple" method args
+// since there is no saving
+if (usesSimpleMethodArgumentsOnly(mce)) return null;
 
 variableExpression.setAccessedVariable(logNode);
-
-if (!loggingStrategy.isLoggingMethod(methodName)) return exp;
-
-return 
loggingStrategy.wrapLoggingMethodCall(variableExpression, methodName, exp);
+return 
loggingStrategy.wrapLoggingMethodCall(variableExpression, methodName, mce);
 }
 
 private boolean usesSimpleMethodArgumentsOnly(MethodCallExpression 
mce) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/e96a9619/src/test/groovy/bugs/Groovy8060Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy8060Bug.groovy 
b/src/test/groovy/bugs/Groovy8060Bug.groovy
new file mode 100644
index 000..741929b
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy8060Bug.groovy
@@ -0,0 +1,39 @@
+/*
+ *  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
+
+class Groovy8060Bug extends GroovyTestCase {
+void 

[09/10] groovy git commit: GROOVY-5318: generic types in fully-qualified class names parsing error (closes #479)

2017-01-28 Thread sunlan
GROOVY-5318: generic types in fully-qualified class names parsing error (closes 
#479)


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

Branch: refs/heads/parrot
Commit: 84462bb563b0c1c0faf1ef0af623561e60c557e7
Parents: cb2e2c2
Author: paulk 
Authored: Wed Jan 25 21:15:17 2017 +1000
Committer: paulk 
Committed: Sat Jan 28 17:03:06 2017 +1000

--
 .../groovy/antlr/AntlrParserPlugin.java | 19 -
 src/test/groovy/bugs/Groovy5318Bug.groovy   | 30 
 2 files changed, 48 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/84462bb5/src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java
--
diff --git a/src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java 
b/src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java
index 28a0395..6cacbfd 100644
--- a/src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java
+++ b/src/main/org/codehaus/groovy/antlr/AntlrParserPlugin.java
@@ -2907,13 +2907,14 @@ public class AntlrParserPlugin extends ASTHelper 
implements ParserPlugin, Groovy
 StringBuilder buffer = new StringBuilder();
 boolean first = true;
 
-for (; node != null && !isType(TYPE_ARGUMENTS, node); node = 
node.getNextSibling()) {
+while (node != null && !isType(TYPE_ARGUMENTS, node)) {
 if (first) {
 first = false;
 } else {
 buffer.append(".");
 }
 buffer.append(qualifiedName(node));
+node = node.getNextSibling();
 }
 return buffer.toString();
 } else {
@@ -3038,6 +3039,7 @@ public class AntlrParserPlugin extends ASTHelper 
implements ParserPlugin, Groovy
 if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
 answer = makeType(node).makeArray();
 } else {
+checkTypeArgs(node, false);
 answer = ClassHelper.make(qualifiedName(node));
 if (answer.isUsingGenerics()) {
 ClassNode newAnswer = 
ClassHelper.makeWithoutCaching(answer.getName());
@@ -3050,6 +3052,21 @@ public class AntlrParserPlugin extends ASTHelper 
implements ParserPlugin, Groovy
 return answer;
 }
 
+private boolean checkTypeArgs(AST node, boolean seenTypeArgs) {
+if (isType(IDENT, node) && seenTypeArgs) {
+throw new ASTRuntimeException(node, "Unexpected type arguments 
found prior to: " + qualifiedName(node));
+}
+if (isType(DOT, node)) {
+AST next = node.getFirstChild();
+while (next != null && !isType(TYPE_ARGUMENTS, next)) {
+seenTypeArgs |= checkTypeArgs(next, seenTypeArgs);
+seenTypeArgs |= isType(TYPE_ARGUMENTS, next.getFirstChild()) 
|| isType(TYPE_ARGUMENTS, next.getNextSibling());
+next = next.getNextSibling();
+}
+}
+return seenTypeArgs;
+}
+
 /**
  * Performs a name resolution to see if the given name is a type from 
imports,
  * aliases or newly created classes

http://git-wip-us.apache.org/repos/asf/groovy/blob/84462bb5/src/test/groovy/bugs/Groovy5318Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy5318Bug.groovy 
b/src/test/groovy/bugs/Groovy5318Bug.groovy
new file mode 100644
index 000..819dd58
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy5318Bug.groovy
@@ -0,0 +1,30 @@
+/*
+ *  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
+
+import gls.CompilableTestSupport
+
+class Groovy5318Bug extends CompilableTestSupport {
+void 

[06/10] groovy git commit: GROOVY-8065: Map created as org.springframework.http.HttpHeaders is empty in 2.4.8, works fine in 2.4.7 (closes #480)

2017-01-28 Thread sunlan
GROOVY-8065: Map created as org.springframework.http.HttpHeaders is empty in 
2.4.8, works fine in 2.4.7 (closes #480)


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

Branch: refs/heads/parrot
Commit: 1358ed58af0df10a959924816310f8f1c020aa50
Parents: e96a961
Author: paulk 
Authored: Thu Jan 26 23:51:32 2017 +1000
Committer: paulk 
Committed: Sat Jan 28 08:46:13 2017 +1000

--
 src/main/groovy/lang/MetaClassImpl.java   | 21 ++-
 src/test/groovy/bugs/Groovy8065Bug.groovy | 48 ++
 2 files changed, 61 insertions(+), 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/1358ed58/src/main/groovy/lang/MetaClassImpl.java
--
diff --git a/src/main/groovy/lang/MetaClassImpl.java 
b/src/main/groovy/lang/MetaClassImpl.java
index d7d8d9b..93c013b 100644
--- a/src/main/groovy/lang/MetaClassImpl.java
+++ b/src/main/groovy/lang/MetaClassImpl.java
@@ -2686,18 +2686,15 @@ public class MetaClassImpl implements MetaClass, 
MutableMetaClass {
 }
 
 
//--
-// turn setProperty on a Map to put on the Map itself
-
//--
-if (method == null && !isStatic && this.isMap) {
-((Map) object).put(name, newValue);
-return;
-}
-
-
//--
 // field
 
//--
 if (method == null && field != null) {
 if (Modifier.isFinal(field.getModifiers())) {
+// GROOVY-5985
+if (!isStatic && this.isMap) {
+((Map) object).put(name, newValue);
+return;
+}
 throw new ReadOnlyPropertyException(name, theClass);
 }
 if(!(this.isMap && isPrivateOrPkgPrivate(field.getModifiers( {
@@ -2742,6 +2739,14 @@ public class MetaClassImpl implements MetaClass, 
MutableMetaClass {
 }
 
 
//--
+// turn setProperty on a Map to put on the Map itself
+
//--
+if (method == null && !isStatic && this.isMap) {
+((Map) object).put(name, newValue);
+return;
+}
+
+
//--
 // error due to missing method/field
 
//--
 if (ambiguousListener) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/1358ed58/src/test/groovy/bugs/Groovy8065Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy8065Bug.groovy 
b/src/test/groovy/bugs/Groovy8065Bug.groovy
new file mode 100644
index 000..5c3f018
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy8065Bug.groovy
@@ -0,0 +1,48 @@
+/*
+ *  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
+
+class Groovy8065Bug extends GroovyTestCase {
+void testMapWithCustomSetDuringAsTypeCast() {
+assertScript '''
+class MapWithSet extends LinkedHashMap {
+void set(String k, String v) {
+put(k.toLowerCase(), v.toUpperCase())
+}
+}
+def m = [Foo: 'Bar'] as MapWithSet
+assert m == [foo: 'BAR']
+'''
+}
+
+void testMapWithPublicField() {
+assertScript '''
+class A extends HashMap {
+

[10/10] groovy git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/groovy into parrot

2017-01-28 Thread sunlan
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/groovy into 
parrot


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

Branch: refs/heads/parrot
Commit: 5392eb4fa0970fb7036fc2730ec5f177af278039
Parents: a033231 84462bb
Author: sunlan 
Authored: Sun Jan 29 00:07:35 2017 +0800
Committer: sunlan 
Committed: Sun Jan 29 00:07:35 2017 +0800

--
 src/main/groovy/lang/MetaClassImpl.java | 21 +
 .../groovy/antlr/AntlrParserPlugin.java | 19 +++-
 src/main/org/codehaus/groovy/ast/ASTNode.java   |  2 +-
 .../asm/sc/StaticTypesCallSiteWriter.java   |  2 +-
 .../groovy/transform/LogASTTransformation.java  | 24 ++
 .../trait/SuperCallTraitTransformer.java| 44 ++
 .../transform/trait/TraitASTTransformation.java |  6 +++
 .../codehaus/groovy/transform/trait/Traits.java |  2 +-
 src/test/groovy/bugs/Groovy5318Bug.groovy   | 30 
 src/test/groovy/bugs/Groovy8060Bug.groovy   | 39 
 src/test/groovy/bugs/Groovy8065Bug.groovy   | 48 
 src/test/groovy/bugs/Groovy8066Bug.groovy   | 33 ++
 12 files changed, 229 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/5392eb4f/src/main/groovy/lang/MetaClassImpl.java
--

http://git-wip-us.apache.org/repos/asf/groovy/blob/5392eb4f/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
--
diff --cc 
src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
index a1d18bf,c34be18..37bfe88
--- 
a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
+++ 
b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
@@@ -627,12 -626,12 +627,12 @@@ public class StaticTypesCallSiteWriter 
  ClassNode classNode = controller.getClassNode();
  ClassNode rType = typeChooser.resolveType(receiver, classNode);
  ClassNode aType = typeChooser.resolveType(arguments, classNode);
 -if (trySubscript(receiver, message, arguments, rType, aType)) {
 +if (trySubscript(receiver, message, arguments, rType, aType, safe)) {
  return;
  }
- // new try with flow type instead of declaration type
+ // now try with flow type instead of declaration type
  rType = receiver.getNodeMetaData(StaticTypesMarker.INFERRED_TYPE);
 -if (rType!=null && trySubscript(receiver, message, arguments, rType, 
aType)) {
 +if (rType!=null && trySubscript(receiver, message, arguments, rType, 
aType, safe)) {
  return;
  }
  // todo: more cases



groovy git commit: Add more test cases for the standard "for" loop statement

2017-01-28 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/parrot 4e3b987aa -> a033231e2


Add more test cases for the standard "for" loop statement


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

Branch: refs/heads/parrot
Commit: a033231e223bc7fec108773bec200c5cfb33195b
Parents: 4e3b987
Author: sunlan 
Authored: Sat Jan 28 23:00:51 2017 +0800
Committer: sunlan 
Committed: Sat Jan 28 23:00:51 2017 +0800

--
 .../src/test/resources/core/For_05x.groovy  | 20 ++--
 1 file changed, 18 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/a033231e/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
--
diff --git 
a/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy 
b/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
index fe55805..959d2c0 100644
--- a/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
+++ b/subprojects/groovy-parser-antlr4/src/test/resources/core/For_05x.groovy
@@ -6,8 +6,16 @@ def testCS() {
 for (int i = 0, n = 5; i < n; i++) {
 result += i
 }
-
 assert 10 == result
+
+result = 0;
+int i;
+int j;
+for (i = 1, j = 5; i < j; i++, j--) {
+result += i;
+result += j;
+}
+assert 12 == result
 }
 testCS();
 
@@ -16,7 +24,15 @@ def test() {
 for (int i = 0, n = 5; i < n; i++) {
 result += i
 }
-
 assert 10 == result
+
+result = 0;
+int i;
+int j;
+for (i = 1, j = 5; i < j; i++, j--) {
+result += i;
+result += j;
+}
+assert 12 == result
 }
 test();



groovy git commit: Minor refactoring

2017-01-28 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/parrot 35ec2156e -> 4e3b987aa


Minor refactoring


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

Branch: refs/heads/parrot
Commit: 4e3b987aae15597858825bad4b58b3bf1217ce05
Parents: 35ec215
Author: sunlan 
Authored: Sat Jan 28 22:29:29 2017 +0800
Committer: sunlan 
Committed: Sat Jan 28 22:29:29 2017 +0800

--
 .../groovy/classgen/asm/StatementWriter.java  | 18 ++
 .../apache/groovy/parser/antlr4/AstBuilder.java   | 15 +--
 2 files changed, 11 insertions(+), 22 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/4e3b987a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
index c36916f..719c4e9 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
@@ -150,6 +150,14 @@ public class StatementWriter {
 compileStack.pop();
 }
 
+private void visitExpressionOfLoopStatement(Expression expression) {
+if (expression instanceof ClosureListExpression) {
+((ClosureListExpression) 
expression).getExpressions().forEach(this::visitExpressionOrStatement);
+} else {
+visitExpressionOrStatement(expression);
+}
+}
+
 protected void writeForLoopWithClosureList(ForStatement loop) {
 controller.getAcg().onLineNumber(loop,"visitForLoop");
 writeStatementLabel(loop);
@@ -168,13 +176,7 @@ public class StatementWriter {
 
 // visit init
 for (int i = 0; i < condIndex; i++) {
-Expression expression = expressions.get(i);
-
-if (expression instanceof ClosureListExpression) {
-((ClosureListExpression) 
expression).getExpressions().forEach(this::visitExpressionOrStatement);
-} else {
-visitExpressionOrStatement(expression);
-}
+visitExpressionOfLoopStatement(expressions.get(i));
 }
 
 Label continueLabel = controller.getCompileStack().getContinueLabel();
@@ -199,7 +201,7 @@ public class StatementWriter {
 // visit increment
 mv.visitLabel(continueLabel);
 for (int i = condIndex + 1; i < size; i++) {
-visitExpressionOrStatement(expressions.get(i));
+visitExpressionOfLoopStatement(expressions.get(i));
 }
 
 // jump to test the condition again

http://git-wip-us.apache.org/repos/asf/groovy/blob/4e3b987a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
--
diff --git 
a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
 
b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 5ba04de..39eb932 100644
--- 
a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
+++ 
b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
@@ -443,20 +443,7 @@ public class AstBuilder extends 
GroovyParserBaseVisitor implements Groov
 if (expressionList.size() == 1) {
 return this.configureAST(expressionList.get(0), ctx);
 } else {
-Statement code =
-this.createBlockStatement(
-expressionList.stream()
-.map(e -> this.configureAST(new 
ExpressionStatement(e), e))
-.collect(Collectors.toList()));
-return this.configureAST(
-new MethodCallExpression(
-this.configureAST(
-new 
ClosureExpression(Parameter.EMPTY_ARRAY, code),
-ctx),
-CALL_STR,
-new ArgumentListExpression()
-),
-ctx);
+return this.configureAST(new 
ClosureListExpression(expressionList), ctx);
 }
 }
 



groovy git commit: Make for loop statement conform to JLS further

2017-01-28 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/parrot fd8841245 -> 35ec2156e


Make for loop statement conform to JLS further


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

Branch: refs/heads/parrot
Commit: 35ec2156e3356f85a666c71ba3d3df3bf74c81ae
Parents: fd88412
Author: sunlan 
Authored: Sat Jan 28 21:39:32 2017 +0800
Committer: sunlan 
Committed: Sat Jan 28 21:39:32 2017 +0800

--
 .../groovy/classgen/asm/StatementWriter.java| 37 --
 .../apache/groovy/parser/antlr4/AstBuilder.java |  7 ++--
 .../parser/antlr4/GroovyParserTest.groovy   |  1 +
 .../src/test/resources/core/For_04x.groovy  | 40 +---
 .../src/test/resources/core/For_05x.groovy  | 22 +++
 5 files changed, 94 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/35ec2156/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
index 4ff1a99..c36916f 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/StatementWriter.java
@@ -21,8 +21,31 @@ package org.codehaus.groovy.classgen.asm;
 import org.codehaus.groovy.ast.ClassHelper;
 import org.codehaus.groovy.ast.ClassNode;
 import org.codehaus.groovy.ast.Parameter;
-import org.codehaus.groovy.ast.expr.*;
-import org.codehaus.groovy.ast.stmt.*;
+import org.codehaus.groovy.ast.expr.ArgumentListExpression;
+import org.codehaus.groovy.ast.expr.BooleanExpression;
+import org.codehaus.groovy.ast.expr.ClosureListExpression;
+import org.codehaus.groovy.ast.expr.ConstantExpression;
+import org.codehaus.groovy.ast.expr.EmptyExpression;
+import org.codehaus.groovy.ast.expr.Expression;
+import org.codehaus.groovy.ast.expr.MethodCallExpression;
+import org.codehaus.groovy.ast.stmt.AssertStatement;
+import org.codehaus.groovy.ast.stmt.BlockStatement;
+import org.codehaus.groovy.ast.stmt.BreakStatement;
+import org.codehaus.groovy.ast.stmt.CaseStatement;
+import org.codehaus.groovy.ast.stmt.CatchStatement;
+import org.codehaus.groovy.ast.stmt.ContinueStatement;
+import org.codehaus.groovy.ast.stmt.DoWhileStatement;
+import org.codehaus.groovy.ast.stmt.EmptyStatement;
+import org.codehaus.groovy.ast.stmt.ExpressionStatement;
+import org.codehaus.groovy.ast.stmt.ForStatement;
+import org.codehaus.groovy.ast.stmt.IfStatement;
+import org.codehaus.groovy.ast.stmt.ReturnStatement;
+import org.codehaus.groovy.ast.stmt.Statement;
+import org.codehaus.groovy.ast.stmt.SwitchStatement;
+import org.codehaus.groovy.ast.stmt.SynchronizedStatement;
+import org.codehaus.groovy.ast.stmt.ThrowStatement;
+import org.codehaus.groovy.ast.stmt.TryCatchStatement;
+import org.codehaus.groovy.ast.stmt.WhileStatement;
 import org.codehaus.groovy.classgen.asm.CompileStack.BlockRecorder;
 import org.objectweb.asm.Label;
 import org.objectweb.asm.MethodVisitor;
@@ -137,7 +160,7 @@ public class StatementWriter {
 ClosureListExpression clExpr = (ClosureListExpression) 
loop.getCollectionExpression();
 
controller.getCompileStack().pushVariableScope(clExpr.getVariableScope());
 
-List expressions = clExpr.getExpressions();
+List expressions = clExpr.getExpressions();
 int size = expressions.size();
 
 // middle element is condition, lower half is init, higher half is 
increment
@@ -145,7 +168,13 @@ public class StatementWriter {
 
 // visit init
 for (int i = 0; i < condIndex; i++) {
-visitExpressionOrStatement(expressions.get(i));
+Expression expression = expressions.get(i);
+
+if (expression instanceof ClosureListExpression) {
+((ClosureListExpression) 
expression).getExpressions().forEach(this::visitExpressionOrStatement);
+} else {
+visitExpressionOrStatement(expression);
+}
 }
 
 Label continueLabel = controller.getCompileStack().getContinueLabel();

http://git-wip-us.apache.org/repos/asf/groovy/blob/35ec2156/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
--
diff --git 
a/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
 
b/subprojects/groovy-parser-antlr4/src/main/java/org/apache/groovy/parser/antlr4/AstBuilder.java
index 7f41d00..5ba04de 100644
--- 

groovy git commit: revert test

2017-01-28 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X ea134ceee -> bf8ab581b


revert test


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

Branch: refs/heads/GROOVY_2_4_X
Commit: bf8ab581bd8dfc1ba018f31d825ec861eb5dcefb
Parents: ea134ce
Author: paulk 
Authored: Sat Jan 28 21:31:59 2017 +1000
Committer: paulk 
Committed: Sat Jan 28 21:31:59 2017 +1000

--
 gradle.properties | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/bf8ab581/gradle.properties
--
diff --git a/gradle.properties b/gradle.properties
index 6e05948..9f7 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +1,8 @@
 groovycMain_mx=384m
 groovyJUnit_permSize=64m
-groovyBundleVersion=2.4.10.SNAPSHOT
+groovyBundleVersion=2.4.9.SNAPSHOT
 javacMain_mx=384m
-groovyVersion=2.4.10-SNAPSHOT
+groovyVersion=2.4.9-SNAPSHOT
 org.gradle.jvmargs=-Xmx1G -XX:MaxPermSize=384m -XX:+CMSClassUnloadingEnabled 
-XX:+CMSPermGenSweepingEnabled
 groovyJUnit_mx=512m
 groovycTest_mx=640m



groovy git commit: Bump version on GROOVY_2_4_X branch (test only)

2017-01-28 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 4bc1d0945 -> 02ee3d076


Bump version on GROOVY_2_4_X branch (test only)

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

Branch: refs/heads/GROOVY_2_4_X
Commit: 02ee3d076ca221603456a30529004457d0d72c53
Parents: 4bc1d09
Author: paulk 
Authored: Sat Jan 28 21:23:49 2017 +1000
Committer: paulk 
Committed: Sat Jan 28 21:26:38 2017 +1000

--
 gradle.properties | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/02ee3d07/gradle.properties
--
diff --git a/gradle.properties b/gradle.properties
index 9f7..6e05948 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,8 +1,8 @@
 groovycMain_mx=384m
 groovyJUnit_permSize=64m
-groovyBundleVersion=2.4.9.SNAPSHOT
+groovyBundleVersion=2.4.10.SNAPSHOT
 javacMain_mx=384m
-groovyVersion=2.4.9-SNAPSHOT
+groovyVersion=2.4.10-SNAPSHOT
 org.gradle.jvmargs=-Xmx1G -XX:MaxPermSize=384m -XX:+CMSClassUnloadingEnabled 
-XX:+CMSPermGenSweepingEnabled
 groovyJUnit_mx=512m
 groovycTest_mx=640m