groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject groovy git commit: GROOVY-7930: @SelfType in hierarchy with an interface in the middle (closes #428)
Date Fri, 30 Sep 2016 21:39:46 GMT
Repository: groovy
Updated Branches:
  refs/heads/master 69d930d30 -> db814d5d0


GROOVY-7930: @SelfType in hierarchy with an interface in the middle (closes #428)


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

Branch: refs/heads/master
Commit: db814d5d05b603b0ced54def1681a08249e53764
Parents: 69d930d
Author: paulk <paulk@asert.com.au>
Authored: Thu Sep 22 11:10:54 2016 +1000
Committer: paulk <paulk@asert.com.au>
Committed: Sat Oct 1 07:37:25 2016 +1000

----------------------------------------------------------------------
 .../org/codehaus/groovy/ast/tools/GeneralUtils.java |  2 +-
 .../traitx/TraitASTTransformationTest.groovy        | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/db814d5d/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java b/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
index b7d9deb..6afa4e0 100644
--- a/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
+++ b/src/main/org/codehaus/groovy/ast/tools/GeneralUtils.java
@@ -417,7 +417,7 @@ public class GeneralUtils {
         }
         ClassNode next = type;
         while (next != null) {
-            Collections.addAll(res, next.getInterfaces());
+            res.addAll(next.getAllInterfaces());
             next = next.getSuperClass();
         }
         return res;

http://git-wip-us.apache.org/repos/asf/groovy/blob/db814d5d/src/test/org/codehaus/groovy/transform/traitx/TraitASTTransformationTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/transform/traitx/TraitASTTransformationTest.groovy
b/src/test/org/codehaus/groovy/transform/traitx/TraitASTTransformationTest.groovy
index 9b28d92..cd12aa3 100644
--- a/src/test/org/codehaus/groovy/transform/traitx/TraitASTTransformationTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/traitx/TraitASTTransformationTest.groovy
@@ -2258,6 +2258,22 @@ d.foo()
         assert err.contains("class 'C' implements trait 'B' but does not implement self type
interface 'java.io.Serializable'")
     }
 
+    void testClassDoesNotImplementSelfTypeDefinedInInheritedTrait() {
+        def err = shouldFail '''
+            import groovy.transform.SelfType
+
+            interface Self { def bar() }
+            @SelfType(Self)
+            trait Trait {
+                def foo() { bar() }
+            }
+            interface Middle extends Trait { }
+            class Child implements Middle { }
+            new Child().foo()
+        '''
+        assert err.contains("class 'Child' implements trait 'Trait' but does not implement
self type interface 'Self'")
+    }
+
     void testClassDoesNotImplementSelfTypeUsingAbstractClass() {
         def err = shouldFail '''
         import groovy.transform.SelfType


Mime
View raw message