You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by sh...@apache.org on 2016/06/05 13:30:57 UTC

[1/3] groovy git commit: GROOVY-7849: Verifier should be aware of array type covariance when checking overriding method return types (closes #346)

Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X 984173f3f -> bb3daa2c0


GROOVY-7849: Verifier should be aware of array type covariance when checking overriding method return types (closes #346)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 83e62687913344b8ab8729165a8b5d5f1b54f612
Parents: 984173f
Author: Shil Sinha <sh...@gmail.com>
Authored: Thu Jun 2 13:54:13 2016 -0400
Committer: Shil Sinha <sh...@apache.org>
Committed: Sun Jun 5 09:18:37 2016 -0400

----------------------------------------------------------------------
 .../org/codehaus/groovy/classgen/Verifier.java    |  2 +-
 src/test/groovy/OverrideTest.groovy               | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/83e62687/src/main/org/codehaus/groovy/classgen/Verifier.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/classgen/Verifier.java b/src/main/org/codehaus/groovy/classgen/Verifier.java
index 1e390a9..8797673 100644
--- a/src/main/org/codehaus/groovy/classgen/Verifier.java
+++ b/src/main/org/codehaus/groovy/classgen/Verifier.java
@@ -1358,7 +1358,7 @@ public class Verifier implements GroovyClassVisitor, Opcodes {
 
     private boolean isArrayAssignable(ClassNode node, ClassNode testNode) {
         if (node.isArray() && testNode.isArray()) { return isArrayAssignable(node.getComponentType(), testNode.getComponentType()); }
-        return node.equals(testNode);
+        return isAssignable(node, testNode);
     }
 
     private static Parameter[] cleanParameters(Parameter[] parameters) {

http://git-wip-us.apache.org/repos/asf/groovy/blob/83e62687/src/test/groovy/OverrideTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/OverrideTest.groovy b/src/test/groovy/OverrideTest.groovy
index 78ff192..cf620ed 100644
--- a/src/test/groovy/OverrideTest.groovy
+++ b/src/test/groovy/OverrideTest.groovy
@@ -174,4 +174,22 @@ def d = new Derived()
             new TemplatedInterfaceImplementation()
         '''
     }
+
+    //GROOVY-7849
+    void testArrayReturnTypeCovariance() {
+        assertScript '''
+            interface Base {}
+
+            interface Derived extends Base {}
+
+            interface I {
+                Base[] foo()
+            }
+
+            class C implements I {
+                Derived[] foo() { null }
+            }
+            new C().foo()
+        '''
+    }
 }


[2/3] groovy git commit: GROOVY-7185: Add test (issue fixed by changes for GROOVY-7849)

Posted by sh...@apache.org.
GROOVY-7185: Add test (issue fixed by changes for GROOVY-7849)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: 115d360b37cbe4c1bd2ba372867ee152a74d30bd
Parents: 83e6268
Author: Shil Sinha <sh...@apache.org>
Authored: Sat Jun 4 16:06:31 2016 -0400
Committer: Shil Sinha <sh...@apache.org>
Committed: Sun Jun 5 09:18:44 2016 -0400

----------------------------------------------------------------------
 src/test/groovy/OverrideTest.groovy | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/115d360b/src/test/groovy/OverrideTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/groovy/OverrideTest.groovy b/src/test/groovy/OverrideTest.groovy
index cf620ed..db7537f 100644
--- a/src/test/groovy/OverrideTest.groovy
+++ b/src/test/groovy/OverrideTest.groovy
@@ -192,4 +192,28 @@ def d = new Derived()
             new C().foo()
         '''
     }
+
+    //GROOVY-7185
+    void testArrayReturnTypeCovarianceGenericsVariant() {
+        assertScript '''
+            public interface A<T> {
+                T[] process();
+            }
+
+            public class B implements A<String> {
+                @Override
+                public String[] process() {
+                    return new String[0];
+                }
+            }
+
+            class C extends B {
+                @Override
+                String[] process() {
+                    return super.process()
+                }
+            }
+            new C()
+        '''
+    }
 }


[3/3] groovy git commit: Documentation: correct StandardPropertiesModuleFactory class javadoc

Posted by sh...@apache.org.
Documentation: correct StandardPropertiesModuleFactory class javadoc


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

Branch: refs/heads/GROOVY_2_4_X
Commit: bb3daa2c00e3415a0637323bce35d3938919b5d4
Parents: 115d360
Author: Shil Sinha <sh...@apache.org>
Authored: Sat Jun 4 16:27:27 2016 -0400
Committer: Shil Sinha <sh...@apache.org>
Committed: Sun Jun 5 09:18:50 2016 -0400

----------------------------------------------------------------------
 .../groovy/runtime/m12n/StandardPropertiesModuleFactory.java       | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/bb3daa2c/src/main/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java b/src/main/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
index f0bbdf3..870cbee 100644
--- a/src/main/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
+++ b/src/main/org/codehaus/groovy/runtime/m12n/StandardPropertiesModuleFactory.java
@@ -25,7 +25,7 @@ import java.util.Properties;
 /**
  * This is the standard Groovy module factory. This factory will build a module
  * using the {@link MetaInfExtensionModule} by default, unless a key named
- * "factory" is found in the properties file. If this is the case, then a new
+ * "moduleFactory" is found in the properties file. If this is the case, then a new
  * factory is instantiated and used instead of this factory.
  */
 public class StandardPropertiesModuleFactory extends PropertiesModuleFactory {