groovy git commit: GROOVY-7970: Can't call private method from outer class when using anonymous inner classes and @CS (closes #452)

2016-11-10 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/master 6f39e27d7 -> ad566692d


GROOVY-7970: Can't call private method from outer class when using anonymous 
inner classes and @CS (closes #452)


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

Branch: refs/heads/master
Commit: ad566692dbc355e1962ba6b61a5b8fe1dad8b966
Parents: 6f39e27
Author: paulk 
Authored: Tue Oct 25 14:30:08 2016 +1000
Committer: paulk 
Committed: Fri Nov 11 06:06:10 2016 +1000

--
 .../classgen/asm/sc/StaticInvocationWriter.java |  62 +++--
 .../stc/StaticTypeCheckingVisitor.java  |   7 +-
 src/test/groovy/bugs/Groovy7970Bug.groovy   | 125 +++
 3 files changed, 184 insertions(+), 10 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/ad566692/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
--
diff --git 
a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
index 0541d20..09ca8ae 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
@@ -22,6 +22,7 @@ import org.codehaus.groovy.ast.ASTNode;
 import org.codehaus.groovy.ast.ClassHelper;
 import org.codehaus.groovy.ast.ClassNode;
 import org.codehaus.groovy.ast.ConstructorNode;
+import org.codehaus.groovy.ast.FieldNode;
 import org.codehaus.groovy.ast.GroovyCodeVisitor;
 import org.codehaus.groovy.ast.InnerClassNode;
 import org.codehaus.groovy.ast.MethodNode;
@@ -186,7 +187,16 @@ public class StaticInvocationWriter extends 
InvocationWriter {
 /**
  * Attempts to make a direct method call on a bridge method, if it exists.
  */
+@Deprecated
 protected boolean tryBridgeMethod(MethodNode target, Expression receiver, 
boolean implicitThis, TupleExpression args) {
+return tryBridgeMethod(target, receiver, implicitThis, args, null);
+}
+
+/**
+ * Attempts to make a direct method call on a bridge method, if it exists.
+ */
+protected boolean tryBridgeMethod(MethodNode target, Expression receiver, 
boolean implicitThis,
+  TupleExpression args, ClassNode 
thisClass) {
 ClassNode lookupClassNode;
 if (target.isProtected()) {
 lookupClassNode = controller.getClassNode();
@@ -203,8 +213,22 @@ public class StaticInvocationWriter extends 
InvocationWriter {
 MethodNode bridge = bridges==null?null:bridges.get(target);
 if (bridge != null) {
 Expression fixedReceiver = receiver;
-if (implicitThis && !controller.isInClosure()) {
-fixedReceiver = new PropertyExpression(new 
ClassExpression(lookupClassNode), "this");
+if (implicitThis) {
+if (!controller.isInClosure()) {
+fixedReceiver = new PropertyExpression(new 
ClassExpression(lookupClassNode), "this");
+} else if (thisClass != null) {
+ClassNode current = thisClass.getOuterClass();
+fixedReceiver = new VariableExpression("thisObject", 
current);
+// adjust for multiple levels of nesting if needed
+while (current != null && current instanceof 
InnerClassNode && !lookupClassNode.equals(current)) {
+FieldNode thisField = current.getField("this$0");
+current = current.getOuterClass();
+if (thisField != null) {
+fixedReceiver = new 
PropertyExpression(fixedReceiver, "this$0");
+fixedReceiver.setType(current);
+}
+}
+}
 }
 ArgumentListExpression newArgs = new 
ArgumentListExpression(target.isStatic()?new 
ConstantExpression(null):fixedReceiver);
 for (Expression expression : args.getExpressions()) {
@@ -261,7 +285,7 @@ public class StaticInvocationWriter extends 
InvocationWriter {
 && controller.isInClosure()
 && !target.isPublic()
 && target.getDeclaringClass() != classNode) {
-if (!tryBridgeMethod(target, receiver, implicitThis, args)) {
+if (!tryBridgeMethod(target, receiver, implicitThis, args, 
classNode)) {
 // replace call with an invoker helper call
 

groovy git commit: GROOVY-7994: Anonymous inner class believes protected method in parent's superclass returns Object

2016-11-10 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/master ad566692d -> 81b1cc7b6


GROOVY-7994: Anonymous inner class believes protected method in parent's 
superclass returns Object


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

Branch: refs/heads/master
Commit: 81b1cc7b603659ba58d5f097b73d0f2f1095f8b1
Parents: ad56669
Author: paulk 
Authored: Thu Nov 10 16:31:46 2016 +1000
Committer: paulk 
Committed: Fri Nov 11 06:21:39 2016 +1000

--
 .../stc/StaticTypeCheckingVisitor.java  | 12 +++-
 src/test/groovy/bugs/Groovy7994Bug.groovy   | 69 
 2 files changed, 79 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/81b1cc7b/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 f16ff82..f675526 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -1250,9 +1250,9 @@ public class StaticTypeCheckingVisitor extends 
ClassCodeVisitorSupport {
 if (storeField(field, isThisExpression, pexp, 
receiver.getType(), visitor, receiver.getData(), !readMode))
 return true;
 
-MethodNode getter = current.getGetterMethod("get" + capName);
+MethodNode getter = findGetter(current, "get" + capName, 
pexp.isImplicitThis());
 getter = allowStaticAccessToMember(getter, staticOnly);
-if (getter == null) getter = current.getGetterMethod("is" + 
capName);
+if (getter == null) getter = findGetter(current, "is" + 
capName, pexp.isImplicitThis());
 getter = allowStaticAccessToMember(getter, staticOnly);
 final String setterName = "set" + capName;
 List setters = findSetters(current, setterName, 
false);
@@ -1362,6 +1362,14 @@ public class StaticTypeCheckingVisitor extends 
ClassCodeVisitorSupport {
 return foundGetterOrSetter;
 }
 
+private MethodNode findGetter(ClassNode current, String name, boolean 
searchOuterClasses) {
+MethodNode getterMethod = current.getGetterMethod(name);
+if (getterMethod == null && searchOuterClasses && current instanceof 
InnerClassNode) {
+return findGetter(current.getOuterClass(), name, true);
+}
+return getterMethod;
+}
+
 private ClassNode getTypeForSpreadExpression(ClassNode testClass, 
ClassNode objectExpressionType, PropertyExpression pexp) {
 if (!pexp.isSpreadSafe()) return null;
 MethodCallExpression mce = new MethodCallExpression(new 
VariableExpression("_", testClass), "iterator", 
ArgumentListExpression.EMPTY_ARGUMENTS);

http://git-wip-us.apache.org/repos/asf/groovy/blob/81b1cc7b/src/test/groovy/bugs/Groovy7994Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy7994Bug.groovy 
b/src/test/groovy/bugs/Groovy7994Bug.groovy
new file mode 100644
index 000..4f4c84a
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy7994Bug.groovy
@@ -0,0 +1,69 @@
+/*
+ *  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 Groovy7994Bug extends GroovyTestCase {
+void testJavaBeanPropertiesAvailableInInnerClasses() {
+assertScript '''
+import groovy.transform.CompileStatic
+
+@CompileStatic
+class Outer {
+String prop = 'wally'
+String getName() { "sally" }
+class Inner {
+String 

[groovy] Git Push Summary

2016-11-10 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/parrot [created] 48dcfa0ac


[18/50] [abbrv] groovy git commit: trivial refactor (method no longer needed)

2016-11-10 Thread sunlan
trivial refactor (method no longer needed)


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

Branch: refs/heads/parrot
Commit: 2706b53c36d7c74462731d6fc01e5e6f238c1e7a
Parents: 3b7715a
Author: paulk 
Authored: Mon Oct 10 16:19:47 2016 +1000
Committer: paulk 
Committed: Mon Oct 10 16:19:47 2016 +1000

--
 src/test/groovy/lang/BigDecimalObjectRangeTest.java | 4 
 src/test/groovy/lang/BigIntegerObjectRangeTest.java | 4 
 src/test/groovy/lang/DoubleObjectRangeTest.java | 4 
 src/test/groovy/lang/FloatObjectRangeTest.java  | 4 
 src/test/groovy/lang/IntegerObjectRangeTest.java| 4 
 src/test/groovy/lang/LongObjectRangeTest.java   | 4 
 src/test/groovy/lang/ShortObjectRangeTest.java  | 4 
 7 files changed, 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/2706b53c/src/test/groovy/lang/BigDecimalObjectRangeTest.java
--
diff --git a/src/test/groovy/lang/BigDecimalObjectRangeTest.java 
b/src/test/groovy/lang/BigDecimalObjectRangeTest.java
index 6fcc5da..7f5d71f 100644
--- a/src/test/groovy/lang/BigDecimalObjectRangeTest.java
+++ b/src/test/groovy/lang/BigDecimalObjectRangeTest.java
@@ -24,10 +24,6 @@ import java.math.BigDecimal;
  * Tests {@link ObjectRange}s of {@link BigDecimal}s.
  */
 public class BigDecimalObjectRangeTest extends NumberRangeTestCase {
-@Override
-protected void setUp() throws Exception {
-super.setUp();
-}
 
 /**
  * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/groovy/blob/2706b53c/src/test/groovy/lang/BigIntegerObjectRangeTest.java
--
diff --git a/src/test/groovy/lang/BigIntegerObjectRangeTest.java 
b/src/test/groovy/lang/BigIntegerObjectRangeTest.java
index 70b1b32..0a35513 100644
--- a/src/test/groovy/lang/BigIntegerObjectRangeTest.java
+++ b/src/test/groovy/lang/BigIntegerObjectRangeTest.java
@@ -24,10 +24,6 @@ import java.math.BigInteger;
  * Tests {@link ObjectRange}s of {@link BigInteger}s.
  */
 public class BigIntegerObjectRangeTest extends NumberRangeTestCase {
-@Override
-protected void setUp() throws Exception {
-super.setUp();
-}
 
 /**
  * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/groovy/blob/2706b53c/src/test/groovy/lang/DoubleObjectRangeTest.java
--
diff --git a/src/test/groovy/lang/DoubleObjectRangeTest.java 
b/src/test/groovy/lang/DoubleObjectRangeTest.java
index 3ec9dd0..433a0fb 100644
--- a/src/test/groovy/lang/DoubleObjectRangeTest.java
+++ b/src/test/groovy/lang/DoubleObjectRangeTest.java
@@ -24,10 +24,6 @@ package groovy.lang;
  * Tests {@link ObjectRange}s of {@link Double}s.
  */
 public class DoubleObjectRangeTest extends NumberRangeTestCase {
-@Override
-protected void setUp() throws Exception {
-super.setUp();
-}
 
 /**
  * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/groovy/blob/2706b53c/src/test/groovy/lang/FloatObjectRangeTest.java
--
diff --git a/src/test/groovy/lang/FloatObjectRangeTest.java 
b/src/test/groovy/lang/FloatObjectRangeTest.java
index 7ffa9b5..a595400 100644
--- a/src/test/groovy/lang/FloatObjectRangeTest.java
+++ b/src/test/groovy/lang/FloatObjectRangeTest.java
@@ -22,10 +22,6 @@ package groovy.lang;
  * Tests {@link ObjectRange}s of {@link Float}s.
  */
 public class FloatObjectRangeTest extends NumberRangeTestCase {
-@Override
-protected void setUp() throws Exception {
-super.setUp();
-}
 
 /**
  * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/groovy/blob/2706b53c/src/test/groovy/lang/IntegerObjectRangeTest.java
--
diff --git a/src/test/groovy/lang/IntegerObjectRangeTest.java 
b/src/test/groovy/lang/IntegerObjectRangeTest.java
index 968c6d8..8bab654 100644
--- a/src/test/groovy/lang/IntegerObjectRangeTest.java
+++ b/src/test/groovy/lang/IntegerObjectRangeTest.java
@@ -22,10 +22,6 @@ package groovy.lang;
  * Tests {@link ObjectRange}s of {@link Integer}s.
  */
 public class IntegerObjectRangeTest extends NumberRangeTestCase {
-@Override
-protected void setUp() throws Exception {
-super.setUp();
-}
 
 /**
  * {@inheritDoc}

http://git-wip-us.apache.org/repos/asf/groovy/blob/2706b53c/src/test/groovy/lang/LongObjectRangeTest.java

[02/50] [abbrv] groovy git commit: replace bytecode generated ExceptionUtils by a Java based version

2016-11-10 Thread sunlan
replace bytecode generated ExceptionUtils by a Java based version


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

Branch: refs/heads/parrot
Commit: 55c186f429780e97c1f4afa1694d40082942d48f
Parents: 0bbcf68
Author: Jochen Theodorou 
Authored: Tue Oct 4 01:14:33 2016 +0200
Committer: Jochen Theodorou 
Committed: Tue Oct 4 01:14:54 2016 +0200

--
 build.gradle|  2 +-
 gradle/utils.gradle | 57 
 src/main/groovy/lang/Closure.java   |  3 +-
 src/main/groovy/lang/MetaClassImpl.java |  4 +-
 .../callsite/BooleanReturningMethodInvoker.java | 12 ++---
 .../groovy/groovy/text/markup/BaseTemplate.java |  4 +-
 6 files changed, 12 insertions(+), 70 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/55c186f4/build.gradle
--
diff --git a/build.gradle b/build.gradle
index fba0490..e82c4ab 100644
--- a/build.gradle
+++ b/build.gradle
@@ -383,7 +383,7 @@ task dgmConverter(dependsOn:compileJava) {
 }
 
 compileJava {
-dependsOn ensureGrammars, exceptionUtils
+dependsOn ensureGrammars
 options.fork(memoryMaximumSize: javacMain_mx)
 }
 

http://git-wip-us.apache.org/repos/asf/groovy/blob/55c186f4/gradle/utils.gradle
--
diff --git a/gradle/utils.gradle b/gradle/utils.gradle
index b485933..6baf1c9 100644
--- a/gradle/utils.gradle
+++ b/gradle/utils.gradle
@@ -38,60 +38,3 @@ buildscript {
 classpath "org.ow2.asm:asm:$asmVersion"
 }
 }
-
-/**
- * This tasks generates an utility class which allows sneaky throwing.
- */
-task exceptionUtils {
-ext.classFiles = [
-
"${buildDir}/generated-classes/org/codehaus/groovy/runtime/ExceptionUtils.class",
-
"${compileJava.destinationDir}/org/codehaus/groovy/runtime/ExceptionUtils.class"]
-outputs.files classFiles
-
-doLast {
-ClassWriter cw = new ClassWriter(0);
-MethodVisitor mv;
-
-cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, 
'org/codehaus/groovy/runtime/ExceptionUtils', null, 'java/lang/Object', null);
-
-cw.visitSource('ExceptionUtils.java', null);
-
-mv = cw.visitMethod(ACC_PUBLIC, '', '()V', null, null);
-mv.visitCode();
-Label l0 = new Label();
-mv.visitLabel(l0);
-mv.visitLineNumber(18, l0);
-mv.visitVarInsn(ALOAD, 0);
-mv.visitMethodInsn(INVOKESPECIAL, 'java/lang/Object', '', '()V', 
false);
-mv.visitInsn(RETURN);
-Label l1 = new Label();
-mv.visitLabel(l1);
-mv.visitLocalVariable('this', 
'Lorg/codehaus/groovy/runtime/ExceptionUtils;', null, l0, l1, 0);
-mv.visitMaxs(1, 1);
-mv.visitEnd();
-
-mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, 'sneakyThrow', 
'(Ljava/lang/Throwable;)V', null, null);
-mv.visitCode();
-Label l2 = new Label();
-mv.visitLabel(l2);
-mv.visitLineNumber(20, l2);
-mv.visitVarInsn(ALOAD, 0);
-mv.visitInsn(ATHROW);
-Label l3 = new Label();
-mv.visitLabel(l3);
-mv.visitLocalVariable('e', 'Ljava/lang/Throwable;', null, l2, l3, 0);
-mv.visitMaxs(1, 1);
-mv.visitEnd();
-
-cw.visitEnd();
-
-logger.lifecycle('Generating ExceptionUtils')
-classFiles.each { classFile ->
-def output = file(classFile)
-output.parentFile.mkdirs()
-output.withOutputStream {
-it << cw.toByteArray()
-}
-}
-}
-}

http://git-wip-us.apache.org/repos/asf/groovy/blob/55c186f4/src/main/groovy/lang/Closure.java
--
diff --git a/src/main/groovy/lang/Closure.java 
b/src/main/groovy/lang/Closure.java
index 503a01b..e6bd284 100644
--- a/src/main/groovy/lang/Closure.java
+++ b/src/main/groovy/lang/Closure.java
@@ -18,6 +18,7 @@
  */
 package groovy.lang;
 
+import org.apache.groovy.internal.util.UncheckedThrow;
 import org.codehaus.groovy.reflection.ReflectionCache;
 import org.codehaus.groovy.reflection.stdclasses.CachedClosureClass;
 import org.codehaus.groovy.runtime.*;
@@ -413,7 +414,7 @@ public abstract class Closure extends 
GroovyObjectSupport implements Cloneabl
 try {
 return (V) getMetaClass().invokeMethod(this,"doCall",args);
 } catch (InvokerInvocationException e) {
-ExceptionUtils.sneakyThrow(e.getCause());
+UncheckedThrow.rethrow(e.getCause());
 

[16/50] [abbrv] groovy git commit: formatting

2016-11-10 Thread sunlan
formatting


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

Branch: refs/heads/parrot
Commit: 2faa31baf0ba7c4afb947b152ee0830d0a60b34f
Parents: 597a8d5
Author: paulk 
Authored: Mon Oct 10 15:48:02 2016 +1000
Committer: paulk 
Committed: Mon Oct 10 15:48:02 2016 +1000

--
 .../groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy | 8 
 1 file changed, 8 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/2faa31ba/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy
--
diff --git 
a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy 
b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy
index 0f67c6c..22a59de 100644
--- a/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy
+++ b/src/test/org/codehaus/groovy/classgen/asm/sc/bugs/Groovy6757Bug.groovy
@@ -16,14 +16,6 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-
-
-
-
-
-
-
-
 package org.codehaus.groovy.classgen.asm.sc.bugs
 
 import groovy.transform.stc.StaticTypeCheckingTestCase



[04/50] [abbrv] groovy git commit: GROOVY-7955: Groovydoc fails to parse Java source files containing the diamond operator

2016-11-10 Thread sunlan
GROOVY-7955: Groovydoc fails to parse Java source files containing the diamond 
operator


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

Branch: refs/heads/parrot
Commit: 5e74067e817d4f4237f0daec5112796087c8d2c8
Parents: 94137c9
Author: paulk 
Authored: Tue Oct 4 22:20:08 2016 +1000
Committer: paulk 
Committed: Tue Oct 4 22:20:08 2016 +1000

--
 src/main/org/codehaus/groovy/antlr/java/java.g  |  8 +-
 .../tools/groovydoc/GroovyDocToolTest.java  | 16 ++--
 .../testfiles/JavaClassWithDiamond.java | 26 
 3 files changed, 47 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/5e74067e/src/main/org/codehaus/groovy/antlr/java/java.g
--
diff --git a/src/main/org/codehaus/groovy/antlr/java/java.g 
b/src/main/org/codehaus/groovy/antlr/java/java.g
index ac2ced6..1f09715 100644
--- a/src/main/org/codehaus/groovy/antlr/java/java.g
+++ b/src/main/org/codehaus/groovy/antlr/java/java.g
@@ -370,7 +370,7 @@ classTypeSpec[boolean addImagNode]  {Token first = LT(1);}
 
 // A non-built in type name, with possible type parameters
 classOrInterfaceType[boolean addImagNode]  {Token first = LT(1);}
-   :   IDENT^ (typeArguments)?
+   :   IDENT^ (typeArguments|typeArgumentsDiamond)?
(options{greedy=true;}: // match as many as possible
DOT^
IDENT (typeArguments)?
@@ -402,6 +402,12 @@ wildcardType
(("extends" | "super")=> typeArgumentBounds)?
;
 
+typeArgumentsDiamond
+{Token first = LT(1);}
+:   LT! GT!
+{#typeArgumentsDiamond = #(create(TYPE_ARGUMENTS, 
"TYPE_ARGUMENTS",first,LT(1)), #typeArgumentsDiamond);}
+;
+
 // Type arguments to a class or interface type
 typeArguments
 {int currentLtLevel = 0;  Token first = LT(1);}

http://git-wip-us.apache.org/repos/asf/groovy/blob/5e74067e/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
--
diff --git 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
index 9326c85..6b68ef4 100644
--- 
a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
+++ 
b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
@@ -292,9 +292,9 @@ public class GroovyDocToolTest extends GroovyTestCase {
 xmlToolForTests.add(srcList);
 MockOutputTool output = new MockOutputTool();
 xmlToolForTests.renderToOutput(output, MOCK_DIR);
-String doc = output.getText(MOCK_DIR + 
"/org/codehaus/groovy/tools/groovydoc/testfiles/MultiCatchExample.html");
+String doc = output.getText(MOCK_DIR + "/" + base + ".html");
 assertNotNull("No GroovyDoc found for " + base, doc);
-assertTrue(doc, doc.indexOf("foo has a multi-catch exception inside") 
> 0);
+assertTrue(doc, doc.contains("foo has a multi-catch exception 
inside"));
 }
 
 public void testStaticModifier() throws Exception {
@@ -321,6 +321,18 @@ public class GroovyDocToolTest extends GroovyTestCase {
 assertTrue("innerClassMethod found in: \"" + 
classWithAnonymousInnerClassDoc + "\"", 
!classWithAnonymousInnerClassDoc.contains("innerClassMethod"));
 }
 
+public void testJavaClassWithDiamondOperator() throws Exception {
+List srcList = new ArrayList();
+String base = 
"org/codehaus/groovy/tools/groovydoc/testfiles/JavaClassWithDiamond";
+srcList.add(base + ".java");
+xmlTool.add(srcList);
+MockOutputTool output = new MockOutputTool();
+xmlTool.renderToOutput(output, MOCK_DIR);
+String doc = output.getText(MOCK_DIR + "/" + base + ".html");
+assertNotNull("No GroovyDoc found for " + base, doc);
+assertTrue("stringList not found in: \"" + doc + "\"", 
doc.contains("stringList"));
+}
+
 public void testVisibilityPublic() throws Exception {
 Properties props = new Properties();
 props.put("publicScope", "true");

http://git-wip-us.apache.org/repos/asf/groovy/blob/5e74067e/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/testfiles/JavaClassWithDiamond.java
--
diff --git 

[42/50] [abbrv] groovy git commit: typos/formatting

2016-11-10 Thread sunlan
typos/formatting


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

Branch: refs/heads/parrot
Commit: 084e7332e8832a21afea4e33a001780c7d189947
Parents: 35c6f78
Author: paulk 
Authored: Mon Nov 7 20:57:28 2016 +1000
Committer: paulk 
Committed: Mon Nov 7 20:57:28 2016 +1000

--
 .../groovy/classgen/asm/CompileStack.java   | 37 ++--
 1 file changed, 18 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/084e7332/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java 
b/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
index d7220a7..7397307 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
@@ -105,9 +105,9 @@ public class CompileStack implements Opcodes {
 private final LinkedList stateStack = new LinkedList();
 
 // handle different states for the implicit "this"
-private final LinkedList implicitThisStack = new LinkedList();
+private final LinkedList implicitThisStack = new 
LinkedList();
 // handle different states for being on the left hand side
-private final LinkedList lhsStack = new LinkedList();
+private final LinkedList lhsStack = new LinkedList();
 {
 implicitThisStack.add(false);
 lhsStack.add(false);
@@ -130,7 +130,7 @@ public class CompileStack implements Opcodes {
 // stores if implicit or explicit this is used.
 private boolean implicitThis;
 private final WriterController controller;
-private boolean inSpecialConstructallCall;
+private boolean inSpecialConstructorCall;
 
 protected static class LabelRange {
 public Label start;
@@ -171,7 +171,7 @@ public class CompileStack implements Opcodes {
 final Map stackVariables;
 final Map currentBlockNamedLabels;
 final LinkedList finallyBlocks;
-final boolean inSpecialConstructallCall;
+final boolean inSpecialConstructorCall;
 
 StateStackElement() {
 scope = CompileStack.this.scope;
@@ -180,7 +180,7 @@ public class CompileStack implements Opcodes {
 stackVariables = CompileStack.this.stackVariables;
 currentBlockNamedLabels = 
CompileStack.this.currentBlockNamedLabels;
 finallyBlocks = CompileStack.this.finallyBlocks;
-inSpecialConstructallCall = 
CompileStack.this.inSpecialConstructallCall;
+inSpecialConstructorCall = 
CompileStack.this.inSpecialConstructorCall;
 }
 }
 
@@ -204,7 +204,7 @@ public class CompileStack implements Opcodes {
 breakLabel = element.breakLabel;
 stackVariables = element.stackVariables;
 finallyBlocks = element.finallyBlocks;
-inSpecialConstructallCall = element.inSpecialConstructallCall;
+inSpecialConstructorCall = element.inSpecialConstructorCall;
 }
 
 public Label getContinueLabel() {
@@ -388,7 +388,6 @@ public class CompileStack implements Opcodes {
 usedVariables.clear();
 scope = null;
 finallyBlocks.clear();
-mv=null;
 resetVariableIndex(false);
 superBlockNamedLabels.clear();
 currentBlockNamedLabels.clear();
@@ -571,8 +570,8 @@ public class CompileStack implements Opcodes {
 private void makeLocalVariablesOffset(Parameter[] paras,boolean 
isInStaticContext) {
 resetVariableIndex(isInStaticContext);
 
-for (int i = 0; i < paras.length; i++) {
-makeNextVariableID(paras[i].getType(),false);
+for (Parameter para : paras) {
+makeNextVariableID(para.getType(), false);
 }
 localVariableOffset = nextVariableIndex;
 
@@ -586,16 +585,16 @@ public class CompileStack implements Opcodes {
 
 makeLocalVariablesOffset(paras,isInStaticContext);
 
-for (int i = 0; i < paras.length; i++) {
-String name = paras[i].getName();
+for (Parameter para : paras) {
+String name = para.getName();
 BytecodeVariable answer;
-ClassNode type = paras[i].getType();
-if (paras[i].isClosureSharedVariable()) {
-boolean useExistingReference = 
paras[i].getNodeMetaData(ClosureWriter.UseExistingReference.class) != null;
-answer = defineVar(name, paras[i].getOriginType(), true, 
useExistingReference);
+ClassNode type = para.getType();
+if 

[47/50] [abbrv] groovy git commit: JsonGenerator.Converter remove unneeded method

2016-11-10 Thread sunlan
JsonGenerator.Converter remove unneeded method

The `Object convert(Object, String)` method handles the case where a
key name is provided and the docs clearly specify that it may be null
in cases where no key name exists.


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

Branch: refs/heads/parrot
Commit: ca6beb8c4540c9211834a453f398b6b609ee606d
Parents: 491c0af
Author: John Wagenleitner 
Authored: Tue Nov 8 17:11:59 2016 -0800
Committer: John Wagenleitner 
Committed: Tue Nov 8 17:11:59 2016 -0800

--
 .../src/main/java/groovy/json/DefaultJsonGenerator.java | 12 ++--
 .../src/main/java/groovy/json/JsonGenerator.java|  8 
 .../groovy/groovy/json/CustomJsonGeneratorTest.groovy   |  5 -
 .../groovy/groovy/json/DefaultJsonGeneratorTest.groovy  |  4 ++--
 4 files changed, 4 insertions(+), 25 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/ca6beb8c/subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java
--
diff --git 
a/subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java 
b/subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java
index 884486d..a3e54f8 100644
--- 
a/subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java
+++ 
b/subprojects/groovy-json/src/main/java/groovy/json/DefaultJsonGenerator.java
@@ -487,6 +487,7 @@ public class DefaultJsonGenerator implements JsonGenerator {
  * @return true if this converter can successfully convert values of
  *  the given type
  */
+@Override
 public boolean handles(Class type) {
 return this.type.isAssignableFrom(type);
 }
@@ -495,19 +496,10 @@ public class DefaultJsonGenerator implements 
JsonGenerator {
  * Converts a given value.
  *
  * @param value the object to convert
- * @return the converted object
- */
-public Object convert(Object value) {
-return convert(value, null);
-}
-
-/**
- * Converts a given value.
- *
- * @param value the object to convert
  * @param key the key name for the value, may be {@code null}
  * @return the converted object
  */
+@Override
 public Object convert(Object value, String key) {
 return (paramCount == 1) ?
 closure.call(value) :

http://git-wip-us.apache.org/repos/asf/groovy/blob/ca6beb8c/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
--
diff --git 
a/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java 
b/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
index aa81f45..cea8b4b 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
@@ -87,14 +87,6 @@ public interface JsonGenerator {
  * Converts a given object.
  *
  * @param value the object to convert
- * @return the converted object
- */
-Object convert(Object value);
-
-/**
- * Converts a given object.
- *
- * @param value the object to convert
  * @param key the key name for the value, may be {@code null}
  * @return the converted object
  */

http://git-wip-us.apache.org/repos/asf/groovy/blob/ca6beb8c/subprojects/groovy-json/src/test/groovy/groovy/json/CustomJsonGeneratorTest.groovy
--
diff --git 
a/subprojects/groovy-json/src/test/groovy/groovy/json/CustomJsonGeneratorTest.groovy
 
b/subprojects/groovy-json/src/test/groovy/groovy/json/CustomJsonGeneratorTest.groovy
index 08b5178..ad21ee9 100644
--- 
a/subprojects/groovy-json/src/test/groovy/groovy/json/CustomJsonGeneratorTest.groovy
+++ 
b/subprojects/groovy-json/src/test/groovy/groovy/json/CustomJsonGeneratorTest.groovy
@@ -76,11 +76,6 @@ class CustomJsonGeneratorTest extends GroovyTestCase {
 }
 
 @Override
-Object convert(Object value) {
-return convert(value, null)
-}
-
-@Override
 Object convert(Object value, String key) {
 return ((CustomFoo)value).c.call()
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/ca6beb8c/subprojects/groovy-json/src/test/groovy/groovy/json/DefaultJsonGeneratorTest.groovy

[38/50] [abbrv] groovy git commit: fix JsonTest spec test

2016-11-10 Thread sunlan
fix JsonTest spec test


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

Branch: refs/heads/parrot
Commit: b0406ddee71eb1048ca9bd7ca9544f35eb722651
Parents: 1320259
Author: John Wagenleitner 
Authored: Sun Oct 23 17:45:56 2016 -0700
Committer: John Wagenleitner 
Committed: Sun Oct 23 17:45:56 2016 -0700

--
 subprojects/groovy-json/src/spec/test/json/JsonTest.groovy | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/b0406dde/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
--
diff --git a/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy 
b/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
index 28067a6..c230a62 100644
--- a/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
+++ b/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
@@ -114,12 +114,12 @@ class JsonTest extends GroovyTestCase {
 
 def generator = new JsonGenerator.Options()
 .excludeNulls()
-.dateFormat('MM@dd@')
+.dateFormat('@MM')
 .excludeFieldsByName('age', 'password')
 .excludeFieldsByType(URL)
 .build()
 
-assert generator.toJson(person) == '{"dob":"12@15@1984","name":"John"}'
+assert generator.toJson(person) == '{"dob":"1984@12","name":"John"}'
 // end::json_output_generator[]
 '''
 }



[26/50] [abbrv] groovy git commit: Integrate with build scans 1.2

2016-11-10 Thread sunlan
Integrate with build scans 1.2


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

Branch: refs/heads/parrot
Commit: 829bfc3f414af09cfe3ca4d9fc2d23a47104d972
Parents: cff7a3c
Author: Cedric Champeau 
Authored: Sat Oct 15 17:56:46 2016 +0200
Committer: Cedric Champeau 
Committed: Sat Oct 15 17:56:46 2016 +0200

--
 build.gradle | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/829bfc3f/build.gradle
--
diff --git a/build.gradle b/build.gradle
index fb340d9..93e27b4 100644
--- a/build.gradle
+++ b/build.gradle
@@ -46,12 +46,15 @@ buildscript {
 }
 
 plugins {
-id 'com.gradle.build-scan' version '1.0'
+id 'com.gradle.build-scan' version '1.2'
+id 'me.champeau.buildscan-recipes' version '0.1.0-beta-3'
 }
 
 buildScan {
 licenseAgreementUrl = 'https://gradle.com/terms-of-service'
 licenseAgree = 'yes'
+recipe 'git-commit', baseUrl: 'https://github.com/apache/groovy/tree'
+recipes 'git-status', 'teamcity'
 }
 
 apply from: 'gradle/filter.gradle'



[15/50] [abbrv] groovy git commit: GROOVY-7953: property expressions for extension methods on primitives fail STC (closes #442)

2016-11-10 Thread sunlan
GROOVY-7953: property expressions for extension methods on primitives fail STC 
(closes #442)


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

Branch: refs/heads/parrot
Commit: 597a8d563a013763b6866b5ce6b30851e19b0941
Parents: 7285ffc
Author: Shil Sinha 
Authored: Thu Oct 6 17:39:27 2016 -0400
Committer: Shil Sinha 
Committed: Sun Oct 9 12:32:19 2016 -0400

--
 .../stc/StaticTypeCheckingVisitor.java  | 33 +++-
 .../org.codehaus.groovy.runtime.ExtensionModule |  2 +-
 .../org.codehaus.groovy.runtime.ExtensionModule |  2 +-
 .../stc/STCExtensionMethodsTest.groovy  |  6 
 .../sc/StaticCompileExtensionMethodsTest.groovy | 24 ++
 .../m12n/TestPrimitiveWrapperExtension.java | 25 +++
 6 files changed, 76 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/597a8d56/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 df128eb..d5259b6 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -1314,21 +1314,26 @@ public class StaticTypeCheckingVisitor extends 
ClassCodeVisitorSupport {
 }
 }
 // GROOVY-5568, the property may be defined by DGM
-List methods = 
findDGMMethodsByNameAndArguments(getTransformLoader(), testClass, "get" + 
capName, ClassNode.EMPTY_ARRAY);
-for (MethodNode m: 
findDGMMethodsByNameAndArguments(getTransformLoader(), testClass, "is" + 
capName, ClassNode.EMPTY_ARRAY)) {
-if (Boolean_TYPE.equals(getWrapper(m.getReturnType( 
methods.add(m);
-}
-if (!methods.isEmpty()) {
-List methodNodes = chooseBestMethod(testClass, 
methods, ClassNode.EMPTY_ARRAY);
-if (methodNodes.size() == 1) {
-MethodNode getter = methodNodes.get(0);
-if (visitor != null) {
-visitor.visitMethod(getter);
-}
-ClassNode cn = inferReturnTypeGenerics(testClass, getter, 
ArgumentListExpression.EMPTY_ARGUMENTS);
-storeInferredTypeForPropertyExpression(pexp, cn);
+List dgmReceivers = new ArrayList(2);
+dgmReceivers.add(testClass);
+if (isPrimitiveType(testClass)) 
dgmReceivers.add(getWrapper(testClass));
+for (ClassNode dgmReceiver: dgmReceivers) {
+List methods = 
findDGMMethodsByNameAndArguments(getTransformLoader(), dgmReceiver, "get" + 
capName, ClassNode.EMPTY_ARRAY);
+for (MethodNode m : 
findDGMMethodsByNameAndArguments(getTransformLoader(), dgmReceiver, "is" + 
capName, ClassNode.EMPTY_ARRAY)) {
+if (Boolean_TYPE.equals(getWrapper(m.getReturnType( 
methods.add(m);
+}
+if (!methods.isEmpty()) {
+List methodNodes = 
chooseBestMethod(dgmReceiver, methods, ClassNode.EMPTY_ARRAY);
+if (methodNodes.size() == 1) {
+MethodNode getter = methodNodes.get(0);
+if (visitor != null) {
+visitor.visitMethod(getter);
+}
+ClassNode cn = inferReturnTypeGenerics(dgmReceiver, 
getter, ArgumentListExpression.EMPTY_ARGUMENTS);
+storeInferredTypeForPropertyExpression(pexp, cn);
 
-return true;
+return true;
+}
 }
 }
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/597a8d56/src/spec/test-resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
--
diff --git 
a/src/spec/test-resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
 
b/src/spec/test-resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
index 67205e0..4926633 100644
--- 
a/src/spec/test-resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
+++ 
b/src/spec/test-resources/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
@@ -17,5 +17,5 @@
 # IT IS A WORKAROUND FOR 2 DESCRIPTORS ON CLASSPATH!
 moduleName=Test 

[01/50] [abbrv] groovy git commit: fix some badly formed string quoting

2016-11-10 Thread sunlan
Repository: groovy
Updated Branches:
  refs/heads/parrot 48dcfa0ac -> 7efbf9ab6


fix some badly formed string quoting


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

Branch: refs/heads/parrot
Commit: 0bbcf6840f5cfa8c7351cd2d615ecff2df05afa2
Parents: 716d3e6
Author: paulk 
Authored: Tue Oct 4 06:50:23 2016 +1000
Committer: paulk 
Committed: Tue Oct 4 06:50:57 2016 +1000

--
 .../org/codehaus/groovy/tools/shell/commands/DocCommand.groovy | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/0bbcf684/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
--
diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
index a18c847..40dadbf 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/commands/DocCommand.groovy
@@ -109,7 +109,7 @@ class DocCommand extends CommandSupport {
 } else if (hasAWTDesktopPlatformSupport) {
 browseWithAWT(urls)
 } else {
-fail 'Browser could not be opened caused by missing platform 
support for 'java.awt.Desktop'. Please set ' +
+fail 'Browser could not be opened due to missing platform support 
for "java.awt.Desktop". Please set ' +
  "a $ENV_BROWSER_GROOVYSH or $ENV_BROWSER environment variable 
referring to the browser binary to " +
  'solve this issue.'
 }



[24/50] [abbrv] groovy git commit: improved class comment

2016-11-10 Thread sunlan
improved class comment


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

Branch: refs/heads/parrot
Commit: 9e1a65e99276eeb9e8b8cb8c667f655c57dbdea9
Parents: 0515ca5
Author: paulk 
Authored: Thu Oct 13 23:18:16 2016 +1000
Committer: paulk 
Committed: Thu Oct 13 23:18:16 2016 +1000

--
 .../codehaus/groovy/classgen/ClassCompletionVerifier.java| 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/9e1a65e9/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java 
b/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
index 78861f3..a8f4948 100644
--- a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
+++ b/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
@@ -45,7 +45,13 @@ import org.codehaus.groovy.transform.trait.Traits;
 import static java.lang.reflect.Modifier.*;
 import static org.objectweb.asm.Opcodes.*;
 /**
- * ClassCompletionVerifier
+ * Checks that a class satisfies various conditions including:
+ * 
+ * Incorrect class or method access modifiers
+ * No abstract methods appear in a non-abstract class
+ * Existence and correct visibility for inherited members
+ * Invalid attempts to override final members
+ * 
  */
 public class ClassCompletionVerifier extends ClassCodeVisitorSupport {
 



[03/50] [abbrv] groovy git commit: formatting and general tidy up of some tests

2016-11-10 Thread sunlan
formatting and general tidy up of some tests


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

Branch: refs/heads/parrot
Commit: 94137c91379b8152afe7e76e59c6537dc5a12ef3
Parents: 55c186f
Author: paulk 
Authored: Tue Oct 4 10:59:04 2016 +1000
Committer: paulk 
Committed: Tue Oct 4 10:59:32 2016 +1000

--
 gradle/pomconfigurer.gradle |  3 +++
 src/tck/test/gls/ch03/s01/Unicode1.groovy   | 11 +++-
 src/tck/test/gls/ch03/s01/Unicode2.groovy   | 18 +
 .../gls/ch03/s02/LexicalTranslation1.groovy |  4 +--
 src/tck/test/gls/ch03/s02/Longest1.groovy   |  2 --
 .../test/gls/ch03/s03/UnicodeEscapes1.groovy|  5 +---
 .../test/gls/ch03/s03/UnicodeEscapes2.groovy| 27 ++--
 7 files changed, 30 insertions(+), 40 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/gradle/pomconfigurer.gradle
--
diff --git a/gradle/pomconfigurer.gradle b/gradle/pomconfigurer.gradle
index 3f08f4a..2877e8a 100644
--- a/gradle/pomconfigurer.gradle
+++ b/gradle/pomconfigurer.gradle
@@ -576,6 +576,9 @@ project.ext.pomConfigureClosureWithoutTweaks = {
 contributor {
 name 'Santhosh Kumar T'
 }
+contributor {
+name 'Alan Green'
+}
 }
 mailingLists {
 mailingList {

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode1.groovy
--
diff --git a/src/tck/test/gls/ch03/s01/Unicode1.groovy 
b/src/tck/test/gls/ch03/s01/Unicode1.groovy
index 45ab780..92984ab 100644
--- a/src/tck/test/gls/ch03/s01/Unicode1.groovy
+++ b/src/tck/test/gls/ch03/s01/Unicode1.groovy
@@ -17,17 +17,14 @@
  *  under the License.
  */
 package gls.ch03.s01;
+
 /**
  * Except for comments, identifiers and the contents of ... string 
  * literals, all input elements are formed from ASCII characters.
  *
  * TODO: Find a better way to test these things
  * Note that this is a little hard to test since the input file is ASCII.
- *
- * @author Alan Green
- * @author Jeremy Rayner
  */
-
 class Unicode1 extends GroovyTestCase {
 //TODO: find some way to assert that Unicode3.0 + is available
 
@@ -35,7 +32,7 @@ class Unicode1 extends GroovyTestCase {
   * This doc comment checks that Unicode is allowed in javadoc.
   * e.g. \u05D0\u2136\u05d3\u05d7
   */
-public void testComments() {
+void testComments() {
 // Unicode is allowed in comments
 // This is a comment \u0410\u0406\u0414\u0419
 /* Another comment \u05D0\u2136\u05d3\u05d7 */
@@ -44,12 +41,12 @@ class Unicode1 extends GroovyTestCase {
 /***/ // Also valid
 }
 
-public void testStringLiterals() {
+void testStringLiterals() {
 assert 1 == "\u0040".length()
 assert "A" == "\u0041"
 }
 
-public void testCharNotAvailableAsLiteral() {
+void testCharNotAvailableAsLiteral() {
 char a = 'x'
 char b = "x"
 def c = "x".charAt(0)

http://git-wip-us.apache.org/repos/asf/groovy/blob/94137c91/src/tck/test/gls/ch03/s01/Unicode2.groovy
--
diff --git a/src/tck/test/gls/ch03/s01/Unicode2.groovy 
b/src/tck/test/gls/ch03/s01/Unicode2.groovy
index be60ff6..35fbf72 100644
--- a/src/tck/test/gls/ch03/s01/Unicode2.groovy
+++ b/src/tck/test/gls/ch03/s01/Unicode2.groovy
@@ -17,24 +17,20 @@
  *  under the License.
  */
 package gls.ch03.s01;
+
 /**
  * Except for comments, identifiers and the contents of ... string 
  * literals, all input elements are formed from ASCII characters.
- *
- * TODO: Find a better way to test these things
- * Note that this is a little hard to test since the input file is ASCII.
- *
- * @author Jeremy Rayner
  */
-
 class Unicode2 extends GroovyTestCase {
 
-//todo - this doesn't seem to work in raw Java5.0 either
-//public void testUTF16SupplementaryCharacters() {
-//assert 1 == "\uD840\uDC00".length()
-//}
+void testUTF16SupplementaryCharacters() {
+def s = "\uD840\uDC00"
+assert 2 == s.length() // number of Unicode code units
+assert 1 == s.codePointCount(0, s.length()) // number of Unicode code 
points
+}
 
-public void testIdentifiers() {
+void testIdentifiers() {
 def foo\u0044 = 12
 assert 20 == foo\u0044 + 8
 }


[48/50] [abbrv] groovy git commit: JsonGenerator.Options allow registering a custom Converter

2016-11-10 Thread sunlan
JsonGenerator.Options allow registering a custom Converter


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

Branch: refs/heads/parrot
Commit: 6f39e27d75f876a504638bbccd4dddfb44fb41b9
Parents: ca6beb8
Author: John Wagenleitner 
Authored: Tue Nov 8 17:12:15 2016 -0800
Committer: John Wagenleitner 
Committed: Tue Nov 8 17:12:15 2016 -0800

--
 .../main/java/groovy/json/JsonGenerator.java| 16 +++--
 .../groovy/json/DefaultJsonGeneratorTest.groovy | 24 +++-
 2 files changed, 37 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/6f39e27d/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
--
diff --git 
a/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java 
b/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
index cea8b4b..c5b13a3 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/JsonGenerator.java
@@ -198,6 +198,19 @@ public interface JsonGenerator {
 }
 
 /**
+ * Registers a converter that will be called when a type it handles is 
encountered.
+ *
+ * @param converter to register
+ * @return a reference to this {@code Options} instance
+ */
+public Options addConverter(Converter converter) {
+if (converter != null) {
+converters.add(converter);
+}
+return this;
+}
+
+/**
  * Registers a closure that will be called when the specified type or 
subtype
  * is serialized.
  *
@@ -245,8 +258,7 @@ public interface JsonGenerator {
 if (converters.contains(converter)) {
 converters.remove(converter);
 }
-converters.add(converter);
-return this;
+return addConverter(converter);
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/groovy/blob/6f39e27d/subprojects/groovy-json/src/test/groovy/groovy/json/DefaultJsonGeneratorTest.groovy
--
diff --git 
a/subprojects/groovy-json/src/test/groovy/groovy/json/DefaultJsonGeneratorTest.groovy
 
b/subprojects/groovy-json/src/test/groovy/groovy/json/DefaultJsonGeneratorTest.groovy
index c1c17e2..027497e 100644
--- 
a/subprojects/groovy-json/src/test/groovy/groovy/json/DefaultJsonGeneratorTest.groovy
+++ 
b/subprojects/groovy-json/src/test/groovy/groovy/json/DefaultJsonGeneratorTest.groovy
@@ -88,7 +88,7 @@ class DefaultJsonGeneratorTest extends GroovyTestCase {
 }
 }
 
-void testConverters() {
+void testClosureConverters() {
 def generator = new JsonGenerator.Options()
 .addConverter(JsonCyclicReference) { object, key ->
 return "JsonCyclicReference causes a stackoverflow"
@@ -118,6 +118,28 @@ class DefaultJsonGeneratorTest extends GroovyTestCase {
 assert generator.toJson([timeline: Calendar.getInstance()]) == 
'{"timeline":"22 days ago"}'
 }
 
+void testCustomConverters() {
+def converter = new JsonGenerator.Converter() {
+@Override
+boolean handles(Class type) { Date.class == type }
+@Override
+Object convert(Object value, String key) { '42' }
+}
+
+def generator = new JsonGenerator.Options()
+.addConverter(converter)
+.build()
+
+assert generator.toJson([new Date()]) == '["42"]'
+
+def mapConverter = [handles: { Date.class == it }, convert: { obj, key 
-> 7 }]
+generator = new JsonGenerator.Options()
+   .addConverter(mapConverter as JsonGenerator.Converter)
+.build()
+
+assert generator.toJson([new Date()]) == '[7]'
+}
+
 void testConverterAddedLastTakesPrecedence() {
 def options = new JsonGenerator.Options()
 def c1 = { 'c1' }



[10/50] [abbrv] groovy git commit: GROOVY-7960: throw NoSuchElementException instead of returning null (closes #412)

2016-11-10 Thread sunlan
GROOVY-7960: throw NoSuchElementException instead of returning null (closes 
#412)


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

Branch: refs/heads/parrot
Commit: 2e2e4718653234e9b070bb96d115f1902faf745f
Parents: d325790
Author: John Tompkins 
Authored: Sun Sep 4 11:17:31 2016 -0400
Committer: John Wagenleitner 
Committed: Thu Oct 6 20:44:28 2016 -0700

--
 src/main/groovy/lang/IntRange.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/2e2e4718/src/main/groovy/lang/IntRange.java
--
diff --git a/src/main/groovy/lang/IntRange.java 
b/src/main/groovy/lang/IntRange.java
index 46e9b4a..6a87658 100644
--- a/src/main/groovy/lang/IntRange.java
+++ b/src/main/groovy/lang/IntRange.java
@@ -26,6 +26,7 @@ import java.util.AbstractList;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
+import java.util.NoSuchElementException;
 
 /**
  * Represents a list of Integer objects starting at a specified {@code from} 
value up (or down)
@@ -78,8 +79,7 @@ public class IntRange extends AbstractList 
implements Range {
 @Override
 public Integer next() {
 if (!hasNext()) {
-// TODO instead of returning null, do this: throw new 
NoSuchElementException();
-return null;
+throw new NoSuchElementException();
 }
 if (index++ > 0) {
 if (isReverse()) {



[46/50] [abbrv] groovy git commit: Fix StreamingJsonBuilder new method should use generator

2016-11-10 Thread sunlan
Fix StreamingJsonBuilder new method should use generator


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

Branch: refs/heads/parrot
Commit: 491c0afe37543ed518bdff85bb604c742ab7d701
Parents: 8a4c25c
Author: John Wagenleitner 
Authored: Tue Nov 8 17:11:30 2016 -0800
Committer: John Wagenleitner 
Committed: Tue Nov 8 17:11:30 2016 -0800

--
 .../src/main/java/groovy/json/StreamingJsonBuilder.java| 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/491c0afe/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
--
diff --git 
a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java 
b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
index 69d5173..f8c5f72 100644
--- 
a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
+++ 
b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
@@ -728,7 +728,7 @@ public class StreamingJsonBuilder extends 
GroovyObjectSupport {
 writeName(name);
 verifyValue();
 if(json instanceof GString) {
-writer.write(JsonOutput.toJson(json.toString()));
+writer.write(generator.toJson(json.toString()));
 }
 else {
 json.writeTo(writer);



[28/50] [abbrv] groovy git commit: GROOVY-7948: fix completion of static imports in groovysh (closes #438)

2016-11-10 Thread sunlan
GROOVY-7948: fix completion of static imports in groovysh (closes #438)


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

Branch: refs/heads/parrot
Commit: 0bd39f8c9c226ed99f770cce4a8b922a646c54b6
Parents: 3891fce
Author: Abraham Grief 
Authored: Wed Oct 5 13:32:43 2016 -0500
Committer: John Wagenleitner 
Committed: Sat Oct 15 22:28:11 2016 -0700

--
 .../codehaus/groovy/tools/shell/Groovysh.groovy |  1 +
 .../completion/ImportsSyntaxCompletor.groovy| 73 +---
 .../ImportsSyntaxCompletorTest.groovy   | 50 +++---
 3 files changed, 57 insertions(+), 67 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/0bd39f8c/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy
--
diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy
index cf68a98..356b7fd 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/Groovysh.groovy
@@ -75,6 +75,7 @@ class Groovysh extends Shell {
 
 final Interpreter interp
 
+// individual imports are stored without leading 'import ' or trailing ';'
 final List imports = []
 
 int indentSize = 2

http://git-wip-us.apache.org/repos/asf/groovy/blob/0bd39f8c/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
--
diff --git 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
index cb27c57..cb446a6 100644
--- 
a/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
+++ 
b/subprojects/groovy-groovysh/src/main/groovy/org/codehaus/groovy/tools/shell/completion/ImportsSyntaxCompletor.groovy
@@ -31,7 +31,11 @@ class ImportsSyntaxCompletor implements IdentifierCompletor {
 // cache for all preimported classes
 List preimportedClassNames
 // cache for all manually imported classes
-final Map cachedImports = new HashMap()
+final Map cachedImports = new HashMap().withDefault {String key ->
+Collection matchingImports = new TreeSet()
+collectImportedSymbols(key, matchingImports)
+matchingImports
+}
 
 ImportsSyntaxCompletor(final Groovysh shell) {
 this.shell = shell
@@ -41,27 +45,16 @@ class ImportsSyntaxCompletor implements IdentifierCompletor 
{
 boolean complete(final List tokens, final 
List candidates) {
 String prefix = tokens.last().getText()
 boolean foundMatch = findMatchingPreImportedClasses(prefix, candidates)
-for (String importName in shell.imports) {
-foundMatch |= findMatchingImportedClassesCached(prefix, 
importName, candidates)
+for (String importSpec in shell.imports) {
+foundMatch |= findMatchingImportedClassesCached(prefix, 
importSpec, candidates)
 }
 return foundMatch
 }
 
 boolean findMatchingImportedClassesCached(final String prefix, final 
String importSpec, final List candidates) {
-Collection cached
-if (! cachedImports.containsKey(importSpec)) {
-cached = new HashSet()
-collectImportedSymbols(importSpec, cached)
-cachedImports.put(importSpec, cached)
-} else {
-cached = cachedImports.get(importSpec)
-}
-Collection matches = cached.findAll({String it -> 
it.startsWith(prefix)})
-if (matches) {
-candidates.addAll(matches)
-return true
-}
-return false
+candidates.addAll(cachedImports
+.get(importSpec)
+.findAll({String it -> it.startsWith(prefix)}))
 }
 
 boolean findMatchingPreImportedClasses(final String prefix, final 
Collection matches) {
@@ -87,14 +80,12 @@ class ImportsSyntaxCompletor implements IdentifierCompletor 
{
 return foundMatch
 }
 
-private static final String STATIC_IMPORT_PATTERN = ~/^import static 

[41/50] [abbrv] groovy git commit: GROOVY-7976: Sort methods that accept a comparator should accept Comparator (fix DGM signatures - closes #454)

2016-11-10 Thread sunlan
GROOVY-7976: Sort methods that accept a comparator should accept Comparator (fix DGM signatures - closes #454)


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

Branch: refs/heads/parrot
Commit: 35c6f78f0fbeab2009e3bb686687f96ce7304ceb
Parents: 1fa65b4
Author: paulk 
Authored: Mon Oct 31 18:10:30 2016 +1000
Committer: paulk 
Committed: Mon Nov 7 09:51:25 2016 +1000

--
 .../groovy/runtime/DefaultGroovyMethods.java| 10 +++
 .../stc/DefaultGroovyMethodsSTCTest.groovy  | 28 
 2 files changed, 33 insertions(+), 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/35c6f78f/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
--
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java 
b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index c210f99..81bb35e 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -8300,7 +8300,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
  * @return the sorted map
  * @since 1.7.2
  */
-public static  Map sort(Map self, Comparator 
comparator) {
+public static  Map sort(Map self, Comparator 
comparator) {
 Map result = new TreeMap(comparator);
 result.putAll(self);
 return result;
@@ -8384,7 +8384,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
  * @return the sorted items as an Iterator
  * @since 1.5.5
  */
-public static  Iterator sort(Iterator self, Comparator 
comparator) {
+public static  Iterator sort(Iterator self, Comparator 
comparator) {
 return sort((Iterable) toList(self), true, 
comparator).listIterator();
 }
 
@@ -8428,7 +8428,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
  * @return a sorted List
  * @since 2.2.0
  */
-public static  List sort(Iterable self, boolean mutate, 
Comparator comparator) {
+public static  List sort(Iterable self, boolean mutate, 
Comparator comparator) {
 List list = mutate ? asList(self) : toList(self);
 Collections.sort(list, comparator);
 return list;
@@ -8442,7 +8442,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
  * @return the sorted array
  * @since 1.5.5
  */
-public static  T[] sort(T[] self, Comparator comparator) {
+public static  T[] sort(T[] self, Comparator comparator) {
 return sort(self, true, comparator);
 }
 
@@ -8465,7 +8465,7 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
  * @return a sorted array
  * @since 1.8.1
  */
-public static  T[] sort(T[] self, boolean mutate, Comparator 
comparator) {
+public static  T[] sort(T[] self, boolean mutate, Comparator 
comparator) {
 T[] answer = mutate ? self : self.clone();
 Arrays.sort(answer, comparator);
 return answer;

http://git-wip-us.apache.org/repos/asf/groovy/blob/35c6f78f/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
--
diff --git a/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy 
b/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
index a8a7531..db43b5b 100644
--- a/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
+++ b/src/test/groovy/transform/stc/DefaultGroovyMethodsSTCTest.groovy
@@ -151,5 +151,33 @@ class DefaultGroovyMethodsSTCTest extends 
StaticTypeCheckingTestCase {
 assert !'abc'.allWhitespace
 '''
 }
+
+// GROOVY-7976
+void testSortMethodsWithComparatorAcceptingSubclass() {
+assertScript '''
+class SecondLetterComparator implements Comparator {
+int compare(CharSequence cs1, CharSequence cs2) {
+cs1.charAt(1) <=> cs2.charAt(1)
+}
+}
+
+def orig1 = ['ant', 'rat', 'bug', 'dog']
+def sorted1 = orig1.sort(false, new SecondLetterComparator())
+assert orig1 == ['ant', 'rat', 'bug', 'dog']
+assert sorted1 == ['rat', 'ant', 'dog', 'bug']
+
+String[] orig2 = ['ant', 'rat', 'bug', 'dog']
+def sorted2 = orig2.sort(false, new SecondLetterComparator())
+assert orig2 == ['ant', 'rat', 'bug', 'dog']
+

[39/50] [abbrv] groovy git commit: GROOVY-7973: Class.this not evaluated correctly within a closure within an inner class (closes #451)

2016-11-10 Thread sunlan
GROOVY-7973: Class.this not evaluated correctly within a closure within an 
inner class (closes #451)


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

Branch: refs/heads/parrot
Commit: 5714ed7f8a4f90ad89a831172f7f2f1a72979d82
Parents: b0406dd
Author: paulk 
Authored: Thu Oct 27 20:51:22 2016 +1000
Committer: paulk 
Committed: Fri Oct 28 14:12:54 2016 +1000

--
 .../groovy/classgen/AsmClassGenerator.java  | 17 ++--
 .../stc/StaticTypeCheckingVisitor.java  | 18 ++--
 src/test/groovy/bugs/Groovy7973Bug.groovy   | 94 
 3 files changed, 116 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/5714ed7f/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java 
b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
index 3fb441a..849bf6f 100644
--- a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -961,16 +961,21 @@ public class AsmClassGenerator extends ClassGenerator {
 String ownerName = 
BytecodeHelper.getClassInternalName(iterType);
 if (iterType.getOuterClass()==null) break;
 FieldNode thisField = iterType.getField("this$0");
-if (thisField==null) break;
-ClassNode thisFieldType = thisField.getType();
 iterType = iterType.getOuterClass();
-if (ClassHelper.CLOSURE_TYPE.equals(thisFieldType)) {
-mv.visitFieldInsn(GETFIELD, ownerName, "this$0", 
BytecodeHelper.getTypeDescription(ClassHelper.CLOSURE_TYPE));
+if (thisField == null) {
+// closure within inner class
 mv.visitMethodInsn(INVOKEVIRTUAL, 
BytecodeHelper.getClassInternalName(ClassHelper.CLOSURE_TYPE), "getThisObject", 
"()Ljava/lang/Object;", false);
 mv.visitTypeInsn(CHECKCAST, 
BytecodeHelper.getClassInternalName(iterType));
 } else {
-String typeName = 
BytecodeHelper.getTypeDescription(iterType);
-mv.visitFieldInsn(GETFIELD, ownerName, "this$0", typeName);
+ClassNode thisFieldType = thisField.getType();
+if (ClassHelper.CLOSURE_TYPE.equals(thisFieldType)) {
+mv.visitFieldInsn(GETFIELD, ownerName, "this$0", 
BytecodeHelper.getTypeDescription(ClassHelper.CLOSURE_TYPE));
+mv.visitMethodInsn(INVOKEVIRTUAL, 
BytecodeHelper.getClassInternalName(ClassHelper.CLOSURE_TYPE), "getThisObject", 
"()Ljava/lang/Object;", false);
+mv.visitTypeInsn(CHECKCAST, 
BytecodeHelper.getClassInternalName(iterType));
+} else {
+String typeName = 
BytecodeHelper.getTypeDescription(iterType);
+mv.visitFieldInsn(GETFIELD, ownerName, "this$0", 
typeName);
+}
 }
 }
 controller.getOperandStack().push(type);

http://git-wip-us.apache.org/repos/asf/groovy/blob/5714ed7f/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 d5259b6..dc8f63d 100644
--- a/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/stc/StaticTypeCheckingVisitor.java
@@ -1179,16 +1179,20 @@ public class StaticTypeCheckingVisitor extends 
ClassCodeVisitorSupport {
 
 boolean staticOnlyAccess = 
isClassClassNodeWrappingConcreteType(objectExpressionType);
 if ("this".equals(propertyName) && staticOnlyAccess) {
-// Outer.this
+// Outer.this for any level of nesting
 ClassNode outerNode = 
objectExpressionType.getGenericsTypes()[0].getType();
-ClassNode current = typeCheckingContext.getEnclosingClassNode();
-if (!current.isStaticClass() && current instanceof InnerClassNode) 
{
-InnerClassNode icn = (InnerClassNode) current;
-if (outerNode.equals(icn.getOuterClass())) {
-storeType(pexp, outerNode);
-return true;
+List candidates = 

[33/50] [abbrv] groovy git commit: Add GC stats to build scan

2016-11-10 Thread sunlan
Add GC stats to build scan


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

Branch: refs/heads/parrot
Commit: b24d30dbf8b3f86a45e954b55b3354815e753961
Parents: 3c074dc
Author: Cedric Champeau 
Authored: Sun Oct 16 18:41:12 2016 +0200
Committer: Cedric Champeau 
Committed: Sun Oct 16 18:41:46 2016 +0200

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


http://git-wip-us.apache.org/repos/asf/groovy/blob/b24d30db/build.gradle
--
diff --git a/build.gradle b/build.gradle
index 810f437..cd3e6db 100644
--- a/build.gradle
+++ b/build.gradle
@@ -47,7 +47,7 @@ buildscript {
 
 plugins {
 id 'com.gradle.build-scan' version '1.2'
-id 'me.champeau.buildscan-recipes' version '0.1.0-beta-5'
+id 'me.champeau.buildscan-recipes' version '0.1.0'
 }
 
 buildScan {
@@ -55,7 +55,7 @@ buildScan {
 licenseAgree = 'yes'
 recipe 'git-commit', baseUrl: 'https://github.com/apache/groovy/tree'
 recipe 'teamcity', baseUrl: 'https://ci.groovy-lang.org', guest: 'true'
-recipes 'git-status'
+recipes 'git-status', 'gc-stats'
 }
 
 apply from: 'gradle/filter.gradle'



[19/50] [abbrv] groovy git commit: GROOVY-7646: allow classes to be removed from the ClassInfo cache (closes #444)

2016-11-10 Thread sunlan
GROOVY-7646: allow classes to be removed from the ClassInfo cache (closes #444)


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

Branch: refs/heads/parrot
Commit: d4eadc4cfe63f0d2a01ba872cc2abfdaaf1a8323
Parents: 2706b53
Author: Jochen Kemnade 
Authored: Mon Oct 10 11:15:55 2016 +0200
Committer: John Wagenleitner 
Committed: Tue Oct 11 19:33:16 2016 -0700

--
 .../org/codehaus/groovy/reflection/ClassInfo.java   | 16 
 .../org/codehaus/groovy/runtime/InvokerHelper.java  |  2 ++
 2 files changed, 18 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/d4eadc4c/src/main/org/codehaus/groovy/reflection/ClassInfo.java
--
diff --git a/src/main/org/codehaus/groovy/reflection/ClassInfo.java 
b/src/main/org/codehaus/groovy/reflection/ClassInfo.java
index b5bf80e..57956af 100644
--- a/src/main/org/codehaus/groovy/reflection/ClassInfo.java
+++ b/src/main/org/codehaus/groovy/reflection/ClassInfo.java
@@ -144,6 +144,22 @@ public class ClassInfo implements Finalizable {
 return globalClassValue.get(cls);
 }
 
+/**
+ * Removes a {@code ClassInfo} from the cache.
+ *
+ * This is useful in cases where the Class is parsed from a script, such 
as when
+ * using GroovyClassLoader#parseClass, and is executed for its result but 
the Class
+ * is not retained or cached.  Removing the {@code ClassInfo} associated 
with the Class
+ * will make the Class and its ClassLoader eligible for garbage collection 
sooner that
+ * it would otherwise.
+ *
+ * @param cls the Class associated with the ClassInfo to remove
+ *from cache
+ */
+public static void remove(Class cls) {
+globalClassValue.remove(cls);
+}
+
 public static Collection getAllClassInfo () {
 return getAllGlobalClassInfo();
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/d4eadc4c/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
--
diff --git a/src/main/org/codehaus/groovy/runtime/InvokerHelper.java 
b/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
index faa142c..6f7406a 100644
--- a/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
+++ b/src/main/org/codehaus/groovy/runtime/InvokerHelper.java
@@ -36,6 +36,7 @@ import groovy.lang.SpreadMapEvaluatingException;
 import groovy.lang.Tuple;
 import groovy.lang.Writable;
 import org.codehaus.groovy.control.ResolveVisitor;
+import org.codehaus.groovy.reflection.ClassInfo;
 import org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl;
 import org.codehaus.groovy.runtime.metaclass.MissingMethodExecutionFailed;
 import org.codehaus.groovy.runtime.powerassert.PowerAssertionError;
@@ -86,6 +87,7 @@ public class InvokerHelper {
 
 public static void removeClass(Class clazz) {
 metaRegistry.removeMetaClass(clazz);
+ClassInfo.remove(clazz);
 Introspector.flushFromCaches(clazz);
 }
 



[14/50] [abbrv] groovy git commit: MOP2: first step in implementing the constant meta class and facade

2016-11-10 Thread sunlan
MOP2: first step in implementing the constant meta class and facade


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

Branch: refs/heads/parrot
Commit: 7285ffcfe5efbac1f47a59b1417bf7cf72b75606
Parents: 9e25a9a
Author: Jochen Theodorou 
Authored: Sun Oct 9 18:23:07 2016 +0200
Committer: Jochen Theodorou 
Committed: Sun Oct 9 18:23:32 2016 +0200

--
 .../internal/metaclass/MetaClassConstant.java   | 50 +++
 .../apache/groovy/internal/util/Function.java   | 31 +++
 .../internal/util/ReevaluatingReference.java| 88 
 .../apache/groovy/internal/util/Supplier.java   | 31 +++
 .../groovy/internal/util/UncheckedThrow.java|  1 +
 .../org/apache/groovy/metaclass/MetaClass.java  | 41 +
 src/main/org/apache/groovy/metaclass/Realm.java | 51 
 7 files changed, 278 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/7285ffcf/src/main/org/apache/groovy/internal/metaclass/MetaClassConstant.java
--
diff --git 
a/src/main/org/apache/groovy/internal/metaclass/MetaClassConstant.java 
b/src/main/org/apache/groovy/internal/metaclass/MetaClassConstant.java
new file mode 100644
index 000..df5a7ec
--- /dev/null
+++ b/src/main/org/apache/groovy/internal/metaclass/MetaClassConstant.java
@@ -0,0 +1,50 @@
+/*
+ *  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 org.apache.groovy.internal.metaclass;
+
+import groovy.lang.MetaClassImpl;
+import groovy.lang.MetaMethod;
+import org.apache.groovy.lang.annotation.Incubating;
+
+import java.lang.invoke.SwitchPoint;
+
+/**
+ * The one and only implementation of a meta class.
+ * INTERNAL USE ONLY.
+ */
+@Incubating
+public final class MetaClassConstant {
+private final SwitchPoint switchPoint = new SwitchPoint();
+//TODO Joche: replace with real implementation
+private final MetaClassImpl impl;
+
+public MetaClassConstant(Class clazz) {
+impl = new MetaClassImpl(clazz);
+}
+
+public SwitchPoint getSwitchPoint() {
+return switchPoint;
+}
+
+// TODO Jochen: replace with new MetaMethod
+public MetaMethod getMethod(String name, Class[] parameters) {
+return impl.pickMethod(name, parameters);
+}
+}

http://git-wip-us.apache.org/repos/asf/groovy/blob/7285ffcf/src/main/org/apache/groovy/internal/util/Function.java
--
diff --git a/src/main/org/apache/groovy/internal/util/Function.java 
b/src/main/org/apache/groovy/internal/util/Function.java
new file mode 100644
index 000..3a4fea5
--- /dev/null
+++ b/src/main/org/apache/groovy/internal/util/Function.java
@@ -0,0 +1,31 @@
+/*
+ *  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 org.apache.groovy.internal.util;
+
+import org.apache.groovy.lang.annotation.Incubating;
+
+/**
+ * Backport of Java8 Function.
+ * INTERNAL USE ONLY.
+ */
+@Incubating
+public interface Function {
+R apply(T t);
+}
\ No newline 

[12/50] [abbrv] groovy git commit: output slightly more info when encountering groovydoc errors

2016-11-10 Thread sunlan
output slightly more info when encountering groovydoc errors


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

Branch: refs/heads/parrot
Commit: d0b513ae0782027670057a4745cd13d077a4f790
Parents: 445869f
Author: paulk 
Authored: Fri Oct 7 18:12:59 2016 +1000
Committer: paulk 
Committed: Fri Oct 7 18:14:09 2016 +1000

--
 .../codehaus/groovy/tools/groovydoc/GroovyDocTemplateEngine.java  | 3 +++
 1 file changed, 3 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/d0b513ae/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 ef25bb4..07f7119 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
@@ -87,6 +87,7 @@ public class GroovyDocTemplateEngine {
 binding.put("props", properties);
 templateWithBindingApplied = t.make(binding).toString();
 } catch (Exception e) {
+System.out.println("Error processing class template for: " + 
classDoc.getFullPathName());
 e.printStackTrace();
 }
 return templateWithBindingApplied;
@@ -105,6 +106,7 @@ public class GroovyDocTemplateEngine {
 binding.put("props", properties);
 templateWithBindingApplied = t.make(binding).toString();
 } catch (Exception e) {
+System.out.println("Error processing package template for: " + 
packageDoc.name());
 e.printStackTrace();
 }
 return templateWithBindingApplied;
@@ -123,6 +125,7 @@ public class GroovyDocTemplateEngine {
 binding.put("props", properties);
 templateWithBindingApplied = t.make(binding).toString();
 } catch (Exception e) {
+System.out.println("Error processing root doc template");
 e.printStackTrace();
 }
 return templateWithBindingApplied;



[29/50] [abbrv] groovy git commit: GROOVY-7291: Declaration of double without assignment null in closure (closes #446)

2016-11-10 Thread sunlan
GROOVY-7291: Declaration of double without assignment null in closure (closes 
#446)


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

Branch: refs/heads/parrot
Commit: 302debb894308a398d50468650b3d86c5677e150
Parents: 0bd39f8
Author: zhangbo 
Authored: Mon Oct 10 17:53:36 2016 +0800
Committer: John Wagenleitner 
Committed: Sat Oct 15 23:11:25 2016 -0700

--
 .../classgen/asm/OptimizingStatementWriter.java | 190 ++-
 src/test/groovy/bugs/Groovy7291Bug.groovy   |  41 
 2 files changed, 145 insertions(+), 86 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/302debb8/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
--
diff --git 
a/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
index 41a801a..b6a54d5 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
@@ -43,14 +43,14 @@ import static 
org.codehaus.groovy.ast.tools.WideningCategories.*;
  * A class to write out the optimized statements
  */
 public class OptimizingStatementWriter extends StatementWriter {
-
+
 private static class FastPathData {
 private Label pathStart = new Label();
 private Label afterPath = new Label();
 }
-
+
 public static class ClassNodeSkip{}
-
+
 public static class StatementMeta {
 private boolean optimize=false;
 protected MethodNode target;
@@ -83,7 +83,7 @@ public class OptimizingStatementWriter extends 
StatementWriter {
 MethodCaller.newStatic(BytecodeInterface8.class, "isOrigF"),
 MethodCaller.newStatic(BytecodeInterface8.class, "isOrigZ"),
 };
-
+
 private static final MethodCaller disabledStandardMetaClass = 
MethodCaller.newStatic(BytecodeInterface8.class, "disabledStandardMetaClass");
 private boolean fastPathBlocked = false;
 private final WriterController controller;
@@ -92,26 +92,26 @@ public class OptimizingStatementWriter extends 
StatementWriter {
 super(controller);
 this.controller = controller;
 }
-
+
 private boolean notEnableFastPath(StatementMeta meta) {
 // return false if cannot do fast path and if are already on the path
 return fastPathBlocked || meta==null || !meta.optimize || 
controller.isFastPath();
 }
-
+
 private FastPathData writeGuards(StatementMeta meta, Statement statement) {
 if (notEnableFastPath(meta)) return null;
 controller.getAcg().onLineNumber(statement, null);
 MethodVisitor mv = controller.getMethodVisitor();
 FastPathData fastPathData = new FastPathData();
 Label slowPath = new Label();
-
+
 for (int i=0; i

[07/50] [abbrv] groovy git commit: GROOVY-7958: Incorrect parsing of comma-separated variable declaration as single statement after if/while/for (closes #437)

2016-11-10 Thread sunlan
GROOVY-7958: Incorrect parsing of comma-separated variable declaration as 
single statement after if/while/for (closes #437)


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

Branch: refs/heads/parrot
Commit: f29962c54229ce26eb7adb5a53fa7874afa7813c
Parents: 7775ea4
Author: paulk 
Authored: Wed Oct 5 18:05:43 2016 +1000
Committer: paulk 
Committed: Thu Oct 6 08:51:59 2016 +1000

--
 src/main/org/codehaus/groovy/antlr/groovy.g |  6 -
 src/test/groovy/bugs/Groovy7958Bug.groovy   | 31 
 2 files changed, 36 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/f29962c5/src/main/org/codehaus/groovy/antlr/groovy.g
--
diff --git a/src/main/org/codehaus/groovy/antlr/groovy.g 
b/src/main/org/codehaus/groovy/antlr/groovy.g
index b973a5c..105059a 100644
--- a/src/main/org/codehaus/groovy/antlr/groovy.g
+++ b/src/main/org/codehaus/groovy/antlr/groovy.g
@@ -1975,9 +1975,13 @@ forInClause
 /** In Java, "if", "while", and "for" statements can take random, non-braced 
statements as their bodies.
  *  Support this practice, even though it isn't very Groovy.
  */
-compatibleBodyStatement
+compatibleBodyStatement {Token first = LT(1);}
 :   (LCURLY)=>
 compoundStatement
+// comma sep decl case converted to multiple statements so must be wrapped 
in SLIST when single statement occurs after if/while/for
+|  (declarationStart (varInitializer)? COMMA)=>
+de:declaration
+{#compatibleBodyStatement = #(create(SLIST,"CBSLIST",first,LT(1)),de);}
 |
 statement[EOF]
 ;

http://git-wip-us.apache.org/repos/asf/groovy/blob/f29962c5/src/test/groovy/bugs/Groovy7958Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy7958Bug.groovy 
b/src/test/groovy/bugs/Groovy7958Bug.groovy
new file mode 100644
index 000..1198c39
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy7958Bug.groovy
@@ -0,0 +1,31 @@
+/*
+ *  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 Groovy7958Bug extends GroovyTestCase {
+void testCommaSepVariableDeclarationAfterIf() {
+assertScript """
+int xNext = 0, yNext = 0
+if (false) int x = xNext++, y = yNext++
+assert xNext == 0 && yNext == 0
+if (true) int x = xNext++, y = yNext++
+assert xNext == 1 && yNext == 1
+"""
+}
+}



[30/50] [abbrv] groovy git commit: GROOVY-7291: test workaround until issue is resolved for Indy

2016-11-10 Thread sunlan
GROOVY-7291: test workaround until issue is resolved for Indy


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

Branch: refs/heads/parrot
Commit: bd42f316366b52bab0d7a32b9115fa56f30edc40
Parents: 302debb
Author: John Wagenleitner 
Authored: Sun Oct 16 01:11:45 2016 -0700
Committer: John Wagenleitner 
Committed: Sun Oct 16 01:13:35 2016 -0700

--
 src/test/groovy/bugs/Groovy7291Bug.groovy | 54 +++---
 1 file changed, 39 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/bd42f316/src/test/groovy/bugs/Groovy7291Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy7291Bug.groovy 
b/src/test/groovy/bugs/Groovy7291Bug.groovy
index afac56d..1e83f81 100644
--- a/src/test/groovy/bugs/Groovy7291Bug.groovy
+++ b/src/test/groovy/bugs/Groovy7291Bug.groovy
@@ -18,24 +18,48 @@
  */
 package groovy.bugs
 
-class Groovy7291Bug extends GroovyShellTestCase {
+import groovy.transform.NotYetImplemented
+
+class Groovy7291Bug extends GroovyTestCase {
+
+static final boolean runningWithIndy = 
Boolean.getBoolean('groovy.target.indy')
+
+@NotYetImplemented
+void testPrimitiveDoubleIndy() {
+if (!runningWithIndy) return
+assertScript '''
+double a
+def b = {
+   a = a + 1
+}
+b()
+assert a == 1.0d
+'''
+}
+
 void testPrimitiveDouble() {
-evaluate('''
-double a;
-def b = {
-   a = a + 1;
-}
-b();
-''');
+// TODO: remove this conditional and method above when fixed for Indy
+if (runningWithIndy) return
+
+assertScript '''
+double a
+def b = {
+   a = a + 1
+}
+b()
+assert a == 1.0d
+'''
 }
 
 void testDouble() {
-shouldFail('''
-Double a;
-def b = {
-   a = a + 1;
-}
-b();
-''');
+shouldFail(NullPointerException,
+'''
+Double a;
+def b = {
+   a = a + 1;
+}
+b()
+''')
 }
+
 }



[34/50] [abbrv] groovy git commit: GROOVY-7291: add test to cover all primitives

2016-11-10 Thread sunlan
GROOVY-7291: add test to cover all primitives


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

Branch: refs/heads/parrot
Commit: fe8914e0799f54b24fa4a52613e4eb0371973e53
Parents: b24d30d
Author: John Wagenleitner 
Authored: Fri Oct 21 07:33:15 2016 -0700
Committer: John Wagenleitner 
Committed: Fri Oct 21 07:36:07 2016 -0700

--
 src/test/groovy/bugs/Groovy7291Bug.groovy | 48 ++
 1 file changed, 48 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/fe8914e0/src/test/groovy/bugs/Groovy7291Bug.groovy
--
diff --git a/src/test/groovy/bugs/Groovy7291Bug.groovy 
b/src/test/groovy/bugs/Groovy7291Bug.groovy
index 22203d0..f82925c 100644
--- a/src/test/groovy/bugs/Groovy7291Bug.groovy
+++ b/src/test/groovy/bugs/Groovy7291Bug.groovy
@@ -43,4 +43,52 @@ class Groovy7291Bug extends GroovyTestCase {
 ''')
 }
 
+void testPrimitiveDeclarationHasDefaultValueInClosure() {
+assertScript '''
+boolean z
+byte b
+char c
+short s
+int i
+long j
+float f
+double d
+def cl = {
+assert z == false && z.class == Boolean
+assert b == 0 && b.class == Byte
+assert c == '\u' && c.class == Character
+assert s == 0 && s.class == Short
+assert i == 0 && i.class == Integer
+assert j == 0L && j.class == Long
+assert f == 0.0f && f.class == Float
+assert d == 0.0d && d.class == Double
+}
+cl()
+'''
+}
+
+void testWrapperDeclarationIsNullInClosure() {
+assertScript '''
+Boolean z
+Byte b
+Character c
+Short s
+Integer i
+Long j
+Float f
+Double d
+def cl = {
+assert z == null
+assert b == null
+assert c == null
+assert s == null
+assert i == null
+assert j == null
+assert f == null
+assert d == null
+}
+cl()
+'''
+}
+
 }



[17/50] [abbrv] groovy git commit: GROOVY-7877: The Range abstraction could support numeric ranges where the items in the range differ by some step size different to 1 (closes #366)

2016-11-10 Thread sunlan
GROOVY-7877: The Range abstraction could support numeric ranges where the items 
in the range differ by some step size different to 1 (closes #366)


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

Branch: refs/heads/parrot
Commit: 3b7715a7e17f24a4547995727e99f227447f7bba
Parents: 2faa31b
Author: paulk 
Authored: Thu Jul 7 18:22:36 2016 +1000
Committer: paulk 
Committed: Mon Oct 10 15:54:23 2016 +1000

--
 src/main/groovy/lang/IntRange.java  |  12 +
 src/main/groovy/lang/NumberRange.java   | 629 +++
 src/main/groovy/lang/Range.java |  46 +-
 .../groovy/runtime/ScriptBytecodeAdapter.java   |  14 +-
 .../groovy/lang/BigDecimalNumberRangeTest.java  |  45 ++
 .../groovy/lang/BigIntegerNumberRangeTest.java  |  45 ++
 src/test/groovy/lang/DoubleNumberRangeTest.java |  44 ++
 src/test/groovy/lang/FloatNumberRangeTest.java  |  43 ++
 .../groovy/lang/IntegerNumberRangeTest.java |  43 ++
 src/test/groovy/lang/LongNumberRangeTest.java   |  52 ++
 src/test/groovy/lang/NumberRangeTest.groovy |  76 +++
 src/test/groovy/lang/ShortNumberRangeTest.java  |  42 ++
 12 files changed, 1072 insertions(+), 19 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/3b7715a7/src/main/groovy/lang/IntRange.java
--
diff --git a/src/main/groovy/lang/IntRange.java 
b/src/main/groovy/lang/IntRange.java
index 6a87658..1ca3820 100644
--- a/src/main/groovy/lang/IntRange.java
+++ b/src/main/groovy/lang/IntRange.java
@@ -188,6 +188,18 @@ public class IntRange extends AbstractList 
implements Range {
 checkSize();
 }
 
+/**
+ * Creates a new NumberRange with the same from and 
to as this
+ * IntRange but with a step size of stepSize.
+ *
+ * @param stepSize the desired step size
+ * @return a new NumberRange
+ * @since 2.5
+ */
+public  NumberRange by(T stepSize) {
+return new NumberRange(NumberRange.comparableNumber((Number)from), 
NumberRange.comparableNumber((Number)to), stepSize, inclusive);
+}
+
 private void checkSize() {
 // size() in the Collection interface returns an integer, so ranges 
can have no more than Integer.MAX_VALUE elements
 final Long size = (long) to - from + 1;

http://git-wip-us.apache.org/repos/asf/groovy/blob/3b7715a7/src/main/groovy/lang/NumberRange.java
--
diff --git a/src/main/groovy/lang/NumberRange.java 
b/src/main/groovy/lang/NumberRange.java
new file mode 100644
index 000..92c6195
--- /dev/null
+++ b/src/main/groovy/lang/NumberRange.java
@@ -0,0 +1,629 @@
+/*
+ * 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.lang;
+
+import org.codehaus.groovy.runtime.InvokerHelper;
+import org.codehaus.groovy.runtime.IteratorClosureAdapter;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.AbstractList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import static org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareEqual;
+import static 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareGreaterThan;
+import static 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareGreaterThanEqual;
+import static 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareLessThan;
+import static 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareLessThanEqual;
+import static 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareNotEqual;
+import static org.codehaus.groovy.runtime.ScriptBytecodeAdapter.compareTo;
+import static org.codehaus.groovy.runtime.dgmimpl.NumberNumberMinus.minus;
+import static 
org.codehaus.groovy.runtime.dgmimpl.NumberNumberMultiply.multiply;
+import static 

[31/50] [abbrv] groovy git commit: Upgrade to build scan recipes 0.1.0-beta-5

2016-11-10 Thread sunlan
Upgrade to build scan recipes 0.1.0-beta-5


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

Branch: refs/heads/parrot
Commit: 7266497fc88fdda35392c79eaf47848286c2308f
Parents: bd42f31
Author: Cedric Champeau 
Authored: Sun Oct 16 15:46:28 2016 +0200
Committer: Cedric Champeau 
Committed: Sun Oct 16 15:47:14 2016 +0200

--
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/7266497f/build.gradle
--
diff --git a/build.gradle b/build.gradle
index e5080a6..810f437 100644
--- a/build.gradle
+++ b/build.gradle
@@ -47,7 +47,7 @@ buildscript {
 
 plugins {
 id 'com.gradle.build-scan' version '1.2'
-id 'me.champeau.buildscan-recipes' version '0.1.0-beta-4'
+id 'me.champeau.buildscan-recipes' version '0.1.0-beta-5'
 }
 
 buildScan {



[36/50] [abbrv] groovy git commit: JsonGenerator - JSON serialization options (closes #371, closes #433)

2016-11-10 Thread sunlan
http://git-wip-us.apache.org/repos/asf/groovy/blob/13202599/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
--
diff --git a/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy 
b/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
index b320939..28067a6 100644
--- a/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
+++ b/subprojects/groovy-json/src/spec/test/json/JsonTest.groovy
@@ -94,6 +94,74 @@ class JsonTest extends GroovyTestCase {
 '''
 }
 
+void testJsonOutputWithGenerator() {
+assertScript '''
+import groovy.json.*
+
+// tag::json_output_generator[]
+class Person {
+String name
+String title
+int age
+String password
+Date dob
+URL favoriteUrl
+}
+
+Person person = new Person(name: 'John', title: null, age: 21, 
password: 'secret',
+dob: Date.parse('-MM-dd', 
'1984-12-15'),
+favoriteUrl: new 
URL('http://groovy-lang.org/'))
+
+def generator = new JsonGenerator.Options()
+.excludeNulls()
+.dateFormat('MM@dd@')
+.excludeFieldsByName('age', 'password')
+.excludeFieldsByType(URL)
+.build()
+
+assert generator.toJson(person) == '{"dob":"12@15@1984","name":"John"}'
+// end::json_output_generator[]
+'''
+}
+
+void testJsonOutputConverter() {
+assertScript '''
+import groovy.json.*
+import static groovy.test.GroovyAssert.shouldFail
+
+// tag::json_output_converter[]
+class Person {
+String name
+URL favoriteUrl
+}
+
+Person person = new Person(name: 'John', favoriteUrl: new 
URL('http://groovy-lang.org/json.html#_jsonoutput'))
+
+def generator = new JsonGenerator.Options()
+.addConverter(URL) { URL u, String key ->
+if (key == 'favoriteUrl') {
+'"' + u.getHost() + '"'
+} else {
+JsonOutput.toJson(u)
+}
+}
+.build()
+
+assert generator.toJson(person) == 
'{"favoriteUrl":"groovy-lang.org","name":"John"}'
+
+// No key available when generating a JSON Array
+def list = [new URL('http://groovy-lang.org/json.html#_jsonoutput')]
+assert generator.toJson(list) == 
'["http://groovy-lang.org/json.html#_jsonoutput;]'
+
+// First parameter to the converter must match the type for which it 
is registered
+shouldFail(IllegalArgumentException) {
+new JsonGenerator.Options()
+.addConverter(Date) { Calendar cal -> }
+}
+// end::json_output_converter[]
+'''
+}
+
 void testPrettyPrint() {
 // tag::pretty_print[]
 def json = JsonOutput.toJson([name: 'John Doe', age: 42])

http://git-wip-us.apache.org/repos/asf/groovy/blob/13202599/subprojects/groovy-json/src/spec/test/json/StreamingJsonBuilderTest.groovy
--
diff --git 
a/subprojects/groovy-json/src/spec/test/json/StreamingJsonBuilderTest.groovy 
b/subprojects/groovy-json/src/spec/test/json/StreamingJsonBuilderTest.groovy
index c9bb0fe..7deb2ae 100644
--- a/subprojects/groovy-json/src/spec/test/json/StreamingJsonBuilderTest.groovy
+++ b/subprojects/groovy-json/src/spec/test/json/StreamingJsonBuilderTest.groovy
@@ -18,8 +18,6 @@
  */
 package json
 
-import groovy.util.GroovyTestCase
-
 class StreamingJsonBuilderTest extends GroovyTestCase {
 
 void testStreamingJsonBuilder() {
@@ -72,4 +70,37 @@ class StreamingJsonBuilderTest extends GroovyTestCase {
 // end::json_assert[]
"""
 }
+
+void testStreamingJsonBuilderWithGenerator() {
+assertScript '''
+import groovy.json.*
+// tag::streaming_json_builder_generator[]
+def generator = new JsonGenerator.Options()
+.excludeNulls()
+.excludeFieldsByName('make', 'country', 'record')
+.excludeFieldsByType(Number)
+.addConverter(URL) { url -> '"http://groovy-lang.org;' }
+.build()
+
+StringWriter writer = new StringWriter()
+StreamingJsonBuilder builder = new StreamingJsonBuilder(writer, 
generator)
+
+builder.records {
+  car {
+name 'HSV Maloo'
+make 'Holden'
+year 2006
+country 'Australia'
+homepage new URL('http://example.org')
+record {
+type 'speed'
+description 'production pickup truck with speed of 
271kph'
+}
+  

[08/50] [abbrv] groovy git commit: GROOVY-7952: Property expressions for extension methods starting with 'is' fail STC (closes #436) * Add support for 'is' getter method variants of GROOVY-5580

2016-11-10 Thread sunlan
GROOVY-7952: Property expressions for extension methods starting with 'is' fail 
STC (closes #436)
* Add support for 'is' getter method variants of GROOVY-5580


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

Branch: refs/heads/parrot
Commit: c504e645521315a3eee9bf07e6254e19ef3d2a0a
Parents: f29962c
Author: Shil Sinha 
Authored: Tue Oct 4 17:08:20 2016 -0400
Committer: Shil Sinha 
Committed: Wed Oct 5 20:10:00 2016 -0400

--
 src/main/org/codehaus/groovy/ast/ClassNode.java |  4 ++-
 .../asm/sc/StaticTypesCallSiteWriter.java   | 18 ---
 .../stc/StaticTypeCheckingVisitor.java  |  3 ++
 .../stc/DefaultGroovyMethodsSTCTest.groovy  |  7 +
 .../transform/stc/MethodCallsSTCTest.groovy | 33 
 5 files changed, 59 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/c504e645/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 fee628f..9b885fd 100644
--- a/src/main/org/codehaus/groovy/ast/ClassNode.java
+++ b/src/main/org/codehaus/groovy/ast/ClassNode.java
@@ -1092,10 +1092,12 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 
 public MethodNode getGetterMethod(String getterName, boolean 
searchSuperClasses) {
 MethodNode getterMethod = null;
+boolean booleanReturnOnly = getterName.startsWith("is");
 for (MethodNode method : getDeclaredMethods(getterName)) {
 if (getterName.equals(method.getName())
 && ClassHelper.VOID_TYPE!=method.getReturnType()
-&& method.getParameters().length == 0) {
+&& method.getParameters().length == 0
+&& (!booleanReturnOnly || 
ClassHelper.Boolean_TYPE.equals(ClassHelper.getWrapper(method.getReturnType()
 {
 // GROOVY-7363: There can be multiple matches for a getter 
returning a generic parameter type, due to
 // the generation of a bridge method. The real getter is 
really the non-bridge, non-synthetic one as it
 // has the most specific and exact return type of the two. 
Picking the bridge method results in loss of

http://git-wip-us.apache.org/repos/asf/groovy/blob/c504e645/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
--
diff --git 
a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
index e955efc..9a62622 100644
--- 
a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
+++ 
b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticTypesCallSiteWriter.java
@@ -158,19 +158,24 @@ public class StaticTypesCallSiteWriter extends 
CallSiteWriter implements Opcodes
 
 // GROOVY-5580, it is still possible that we're calling a 
superinterface property
 String getterName = "get" + MetaClassHelper.capitalize(methodName);
+String altGetterName = "is" + MetaClassHelper.capitalize(methodName);
 if (receiverType.isInterface()) {
 Set allInterfaces = receiverType.getAllInterfaces();
 MethodNode getterMethod = null;
 for (ClassNode anInterface : allInterfaces) {
 getterMethod = anInterface.getGetterMethod(getterName);
-if (getterMethod!=null) break;
+if (getterMethod == null) getterMethod = 
anInterface.getGetterMethod(altGetterName);
+if (getterMethod != null) break;
 }
 // GROOVY-5585
-if (getterMethod==null) {
+if (getterMethod == null) {
 getterMethod = OBJECT_TYPE.getGetterMethod(getterName);
 }
+if (getterMethod == null) {
+getterMethod = OBJECT_TYPE.getGetterMethod(altGetterName);
+}
 
-if (getterMethod!=null) {
+if (getterMethod != null) {
 MethodCallExpression call = new MethodCallExpression(
 receiver,
 getterName,
@@ -188,13 +193,16 @@ public class StaticTypesCallSiteWriter extends 
CallSiteWriter implements Opcodes
 
 // GROOVY-5568, we would be facing a DGM call, but instead of 
foo.getText(), have foo.text
 List methods = 

[32/50] [abbrv] groovy git commit: Groovy-7291: reenable tests and fix the fix for indy as well

2016-11-10 Thread sunlan
Groovy-7291: reenable tests and fix the fix for indy as well


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

Branch: refs/heads/parrot
Commit: 3c074dc2058d4c5115f172094385d9efd302f3ce
Parents: 7266497
Author: Jochen Theodorou 
Authored: Sun Oct 16 15:59:50 2016 +0200
Committer: Jochen Theodorou 
Committed: Sun Oct 16 16:01:06 2016 +0200

--
 .../groovy/classgen/AsmClassGenerator.java  |  6 -
 .../groovy/classgen/asm/CompileStack.java   | 15 ---
 .../classgen/asm/OptimizingStatementWriter.java | 28 
 src/test/groovy/bugs/Groovy7291Bug.groovy   | 21 +--
 4 files changed, 22 insertions(+), 48 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/3c074dc2/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java 
b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
index 30a49e0..3fb441a 100644
--- a/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
+++ b/src/main/org/codehaus/groovy/classgen/AsmClassGenerator.java
@@ -396,7 +396,11 @@ public class AsmClassGenerator extends ClassGenerator {
 }
 // we use this NOP to have a valid jump target for the various 
labels
 //mv.visitInsn(NOP);
-mv.visitMaxs(0, 0);
+try {
+mv.visitMaxs(0, 0);
+} catch (Exception e) {
+throw new GroovyRuntimeException("ASM reporting processing 
error for "+controller.getClassNode()+"#"+node.getName()+" with signature 
"+node.getTypeDescriptor()+" in "+sourceFile+":"+node.getLineNumber(), e);
+}
 }
 mv.visitEnd();
 }

http://git-wip-us.apache.org/repos/asf/groovy/blob/3c074dc2/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
--
diff --git a/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java 
b/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
index 8fae1cf..d7220a7 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/CompileStack.java
@@ -658,10 +658,8 @@ public class CompileStack implements Opcodes {
 public BytecodeVariable defineVariable(Variable v, boolean initFromStack) {
 return defineVariable(v, v.getOriginType(), initFromStack);
 }
+
 public BytecodeVariable defineVariable(Variable v, ClassNode variableType, 
boolean initFromStack) {
-//TODO: any usage of this method should have different operand stack 
handing
-//  then the remove(1) here and there in this one can be removed 
and others
-//  can be changed
 String name = v.getName();
 BytecodeVariable answer = defineVar(name, variableType, 
v.isClosureSharedVariable(), v.isClosureSharedVariable());
 stackVariables.put(name, answer);
@@ -672,7 +670,16 @@ public class CompileStack implements Opcodes {
 ClassNode type = answer.getType().redirect();
 OperandStack operandStack = controller.getOperandStack();
 
-if (!initFromStack) pushInitValue(type, mv);
+if (!initFromStack) {
+if (ClassHelper.isPrimitiveType(v.getOriginType()) && 
ClassHelper.getWrapper(v.getOriginType()) == variableType) {
+pushInitValue(v.getOriginType(), mv);
+operandStack.push(v.getOriginType());
+operandStack.box();
+operandStack.remove(1);
+} else {
+pushInitValue(type, mv);
+}
+}
 operandStack.push(answer.getType());
 if (answer.isHolder())  {
 operandStack.box();

http://git-wip-us.apache.org/repos/asf/groovy/blob/3c074dc2/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
--
diff --git 
a/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
index b6a54d5..c9de6f8 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/OptimizingStatementWriter.java
@@ -581,37 +581,19 @@ public class OptimizingStatementWriter extends 
StatementWriter {
 addTypeInformation(expression.getExpression(),expression);
 }
 
-private void 

[35/50] [abbrv] groovy git commit: GROOVY-7932: generate bridge methods for private constructors during static compilation (closes #449)

2016-11-10 Thread sunlan
GROOVY-7932: generate bridge methods for private constructors during static 
compilation (closes #449)


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

Branch: refs/heads/parrot
Commit: 8213bd0792d2741d0c743b4269570a1fd390b2bd
Parents: fe8914e
Author: Shil Sinha 
Authored: Sun Oct 9 16:57:47 2016 -0400
Committer: Shil Sinha 
Committed: Sat Oct 22 16:06:16 2016 -0400

--
 .../classgen/asm/sc/StaticInvocationWriter.java | 19 ++-
 .../transform/sc/StaticCompilationVisitor.java  | 45 +++
 .../asm/sc/StaticCompileConstructorsTest.groovy | 58 
 3 files changed, 107 insertions(+), 15 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/8213bd07/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
--
diff --git 
a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java 
b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
index 18b91c7..0541d20 100644
--- a/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
+++ b/src/main/org/codehaus/groovy/classgen/asm/sc/StaticInvocationWriter.java
@@ -126,21 +126,34 @@ public class StaticInvocationWriter extends 
InvocationWriter {
 cn = new ConstructorNode(mn.getModifiers(), mn.getParameters(), 
mn.getExceptions(), mn.getCode());
 cn.setDeclaringClass(mn.getDeclaringClass());
 }
+TupleExpression args = makeArgumentList(call.getArguments());
 if (cn.isPrivate()) {
 ClassNode classNode = controller.getClassNode();
 ClassNode declaringClass = cn.getDeclaringClass();
 if (declaringClass != classNode) {
-controller.getSourceUnit().addError(new 
SyntaxException("Cannot call private constructor for " + 
declaringClass.toString(false) +
+MethodNode bridge = null;
+if (call.getNodeMetaData(StaticTypesMarker.PV_METHODS_ACCESS) 
!= null) {
+Map bridgeMethods = 
declaringClass.getNodeMetaData(StaticCompilationMetadataKeys.PRIVATE_BRIDGE_METHODS);
+bridge = bridgeMethods != null ? bridgeMethods.get(cn) : 
null;
+}
+if (bridge != null && bridge instanceof ConstructorNode) {
+ArgumentListExpression newArgs = new 
ArgumentListExpression(new ConstantExpression(null));
+for (Expression arg: args) {
+newArgs.addExpression(arg);
+}
+cn = (ConstructorNode) bridge;
+args = newArgs;
+} else {
+controller.getSourceUnit().addError(new 
SyntaxException("Cannot call private constructor for " + 
declaringClass.toString(false) +
 " from class " + classNode.toString(false), 
call.getLineNumber(), call.getColumnNumber(), mn.getLastLineNumber(), 
call.getLastColumnNumber()));
+}
 }
 }
 
 String ownerDescriptor = prepareConstructorCall(cn);
-TupleExpression args = makeArgumentList(call.getArguments());
 int before = controller.getOperandStack().getStackLength();
 loadArguments(args.getExpressions(), cn.getParameters());
 finnishConstructorCall(cn, ownerDescriptor, 
controller.getOperandStack().getStackLength() - before);
-
 }
 
 @Override

http://git-wip-us.apache.org/repos/asf/groovy/blob/8213bd07/src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
--
diff --git 
a/src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java 
b/src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
index f385c49..1e00c50 100644
--- a/src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
+++ b/src/main/org/codehaus/groovy/transform/sc/StaticCompilationVisitor.java
@@ -46,6 +46,8 @@ import static org.codehaus.groovy.ast.tools.GenericsUtils.*;
 import static org.codehaus.groovy.transform.sc.StaticCompilationMetadataKeys.*;
 import static 
org.codehaus.groovy.transform.stc.StaticTypesMarker.DIRECT_METHOD_CALL_TARGET;
 import static org.objectweb.asm.Opcodes.ACC_PUBLIC;
+import static org.objectweb.asm.Opcodes.ACC_STATIC;
+import static org.objectweb.asm.Opcodes.ACC_SYNTHETIC;
 
 /**
  * This visitor is responsible for amending the AST with static compilation 
metadata or transform the AST so that
@@ -248,6 +250,7 @@ public 

[05/50] [abbrv] groovy git commit: align IDEA language level with source compatibility settings

2016-11-10 Thread sunlan
align IDEA language level with source compatibility settings


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

Branch: refs/heads/parrot
Commit: 11270ed8ed5dd62dbeb007737050b0fe29842e32
Parents: 94137c9
Author: paulk 
Authored: Tue Oct 4 22:21:07 2016 +1000
Committer: paulk 
Committed: Tue Oct 4 22:21:07 2016 +1000

--
 gradle/idea.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/11270ed8/gradle/idea.gradle
--
diff --git a/gradle/idea.gradle b/gradle/idea.gradle
index 7db7399..510a9cc 100644
--- a/gradle/idea.gradle
+++ b/gradle/idea.gradle
@@ -48,7 +48,7 @@ idea {
 
 // jdk, language level fix
 def pRoot = node.component.find { it.'@name' == 
'ProjectRootManager' }
-pRoot.'@languageLevel' = 'JDK_1_6'
+pRoot.'@languageLevel' = 'JDK_1_7'
 pRoot.'@project-jdk-name' = '1.8'
 
 // Use git



[20/50] [abbrv] groovy git commit: GROOVY-7646: remove classes via InvokerHelper when closing the GroovyClassLoader or flushing its cache (closes #445)

2016-11-10 Thread sunlan
GROOVY-7646: remove classes via InvokerHelper when closing the 
GroovyClassLoader or flushing its cache (closes #445)


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

Branch: refs/heads/parrot
Commit: 4ea1207f21b93a15dbcca17538c379721d9217de
Parents: d4eadc4
Author: Jochen Berger 
Authored: Mon Oct 10 11:40:53 2016 +0200
Committer: John Wagenleitner 
Committed: Tue Oct 11 19:41:36 2016 -0700

--
 src/main/groovy/lang/GroovyClassLoader.java | 10 ++
 1 file changed, 10 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/4ea1207f/src/main/groovy/lang/GroovyClassLoader.java
--
diff --git a/src/main/groovy/lang/GroovyClassLoader.java 
b/src/main/groovy/lang/GroovyClassLoader.java
index ac1f9f9..c75bb2f 100644
--- a/src/main/groovy/lang/GroovyClassLoader.java
+++ b/src/main/groovy/lang/GroovyClassLoader.java
@@ -34,6 +34,7 @@ import org.codehaus.groovy.ast.expr.ConstantExpression;
 import org.codehaus.groovy.classgen.GeneratorContext;
 import org.codehaus.groovy.classgen.Verifier;
 import org.codehaus.groovy.control.*;
+import org.codehaus.groovy.runtime.InvokerHelper;
 import org.codehaus.groovy.runtime.IOGroovyMethods;
 import org.objectweb.asm.ClassVisitor;
 import org.objectweb.asm.ClassWriter;
@@ -969,6 +970,9 @@ public class GroovyClassLoader extends URLClassLoader {
  */
 public void clearCache() {
 synchronized (classCache) {
+for (Class cl : classCache.values()) {
+InvokerHelper.removeClass(cl);
+}
 classCache.clear();
 }
 synchronized (sourceCache) {
@@ -976,6 +980,12 @@ public class GroovyClassLoader extends URLClassLoader {
 }
 }
 
+@Override
+public void close() throws IOException {
+super.close();
+clearCache();
+}
+
 private static class TimestampAdder extends 
CompilationUnit.PrimaryClassNodeOperation implements Opcodes {
 private final static TimestampAdder INSTANCE = new TimestampAdder();
 



[25/50] [abbrv] groovy git commit: Add groovy-macro documentation (closes #439)

2016-11-10 Thread sunlan
Add groovy-macro documentation (closes #439)


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

Branch: refs/heads/parrot
Commit: cff7a3c3d212f6d64058a427d34170bd30777fa2
Parents: 9e1a65e
Author: Mario Garcia 
Authored: Fri Oct 7 01:27:32 2016 +0200
Committer: paulk 
Committed: Fri Oct 14 20:53:36 2016 +1000

--
 build.gradle|   2 +
 src/spec/doc/core-metaprogramming.adoc  | 237 ++-
 .../ASTMatcherFilteringTest.groovy  | 100 
 .../ASTMatcherTestingTest.groovy| 120 ++
 .../test/metaprogramming/MacroClassTest.groovy  | 101 
 .../metaprogramming/MacroExpressionTest.groovy  |  92 +++
 .../metaprogramming/MacroStatementTest.groovy   | 123 ++
 .../MacroVariableSubstitutionTest.groovy|  93 
 8 files changed, 865 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/cff7a3c3/build.gradle
--
diff --git a/build.gradle b/build.gradle
index e82c4ab..fb340d9 100644
--- a/build.gradle
+++ b/build.gradle
@@ -214,6 +214,7 @@ dependencies {
 
 examplesCompile project(':groovy-test')
 examplesCompile project(':groovy-swing')
+
 examplesCompile "org.apache.lucene:lucene-core:$luceneVersion"
 examplesCompile "org.apache.lucene:lucene-analyzers-common:$luceneVersion"
 examplesCompile "org.apache.lucene:lucene-queryparser:$luceneVersion"
@@ -238,6 +239,7 @@ dependencies {
 
 testCompile project(':groovy-ant')
 testCompile project(':groovy-test')
+testCompile project(':groovy-macro')
 }
 
 ext.generatedDirectory = "${buildDir}/generated-sources"

http://git-wip-us.apache.org/repos/asf/groovy/blob/cff7a3c3/src/spec/doc/core-metaprogramming.adoc
--
diff --git a/src/spec/doc/core-metaprogramming.adoc 
b/src/spec/doc/core-metaprogramming.adoc
index c76ae30..52344fd 100644
--- a/src/spec/doc/core-metaprogramming.adoc
+++ b/src/spec/doc/core-metaprogramming.adoc
@@ -30,7 +30,7 @@ With runtime metaprogramming we can postpone to runtime the 
decision to intercep
 In Groovy we work with three kinds of objects: POJO, POGO and Groovy 
Interceptors. Groovy allows metaprogramming for all types of objects but in 
different manner.
 
 - POJO - A regular Java object, whose class can be written in Java or any 
other language for the JVM.
-- POGO - A Groovy object, whose class is written in Groovy. It extends 
`java.lang.Object` and implements the gapi:groovy.lang.GroovyObject[] interface 
by default. 
+- POGO - A Groovy object, whose class is written in Groovy. It extends 
`java.lang.Object` and implements the gapi:groovy.lang.GroovyObject[] interface 
by default.
 - Groovy Interceptor - A Groovy object that implements the 
gapi:groovy.lang.GroovyInterceptable[] interface and has method-interception 
capability, which we'll discuss in the 
<> section.
 
 For every method call Groovy checks whether the object is a POJO or a POGO. 
For POJOs, Groovy fetches it's `MetaClass` from the 
gapi:groovy.lang.MetaClassRegistry[] and delegates method invocation to it. For 
POGOs, Groovy takes more steps, as illustrated in the following figure:
@@ -79,7 +79,7 @@ Here is a simple example:
 
 
include::{projectdir}/src/spec/test/metaprogramming/GroovyObjectTest.groovy[tags=groovy_get_property,indent=0]
 
-<1> Forwards the request to the getter for all properties except `field3`.  
+<1> Forwards the request to the getter for all properties except `field3`.
 
 You can intercept write access to properties by overriding the `setProperty()` 
method:
 
@@ -139,7 +139,7 @@ something like this:
 class GORM {
 
def dynamicMethods = [...] // an array of dynamic methods that use regex
-   
+
def methodMissing(String name, args) {
def method = dynamicMethods.find { it.match(name) }
if(method) {
@@ -2829,6 +2829,153 @@ to use the Groovy Console, in particular the AST 
browser tool, to gain knowledge
 resource for learning is the 
https://github.com/apache/groovy/tree/master/src/test/org/codehaus/groovy/ast/builder[AST
 Builder]
 test suite.
 
+ Macros
+
+= Introduction
+
+Until version 2.5.0, when developing AST transformations, developers should 
have a deep knowledge about how the AST
+(Abstract Syntax Tree) was built by the compiler in order to know how to add 
new expressions or statements during
+compile time.
+
+Although the use of