[1/2] groovy git commit: GROOVY-7620: No error if abstract getter is not implemented but static field exists (closes #342)

2016-05-31 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_4_X f3d031014 -> 036c14fa0


GROOVY-7620: No error if abstract getter is not implemented but static field 
exists (closes #342)


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

Branch: refs/heads/GROOVY_2_4_X
Commit: df63a38da748fc82d2c703059ca6af3c4dcfb36c
Parents: f3d0310
Author: paulk 
Authored: Tue May 31 21:14:54 2016 +1000
Committer: paulk 
Committed: Wed Jun 1 13:44:15 2016 +1000

--
 src/main/org/codehaus/groovy/ast/ClassNode.java | 23 ---
 .../classgen/ClassCompletionVerifier.java   | 71 +++-
 src/test/groovy/bugs/Groovy7081Bug.groovy   |  2 +-
 src/test/groovy/bugs/Groovy7620Bug.groovy   | 59 
 4 files changed, 114 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/df63a38d/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 c011241..faf4570 100644
--- a/src/main/org/codehaus/groovy/ast/ClassNode.java
+++ b/src/main/org/codehaus/groovy/ast/ClassNode.java
@@ -429,30 +429,33 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 public Map getDeclaredMethodsMap() {
 // Start off with the methods from the superclass.
 ClassNode parent = getSuperClass();
-Map result = null;
+Map result;
 if (parent != null) {
 result = parent.getDeclaredMethodsMap();
 } else {
 result = new HashMap();
 }
+addInterfaceMethods(result);
 
+// And add in the methods implemented in this class.
+for (MethodNode method : getMethods()) {
+String sig = method.getTypeDescriptor();
+result.put(sig, method);
+}
+return result;
+}
+
+public void addInterfaceMethods(Map methodsMap) {
 // add in unimplemented abstract methods from the interfaces
 for (ClassNode iface : getInterfaces()) {
 Map ifaceMethodsMap = 
iface.getDeclaredMethodsMap();
 for (String methSig : ifaceMethodsMap.keySet()) {
-if (!result.containsKey(methSig)) {
+if (!methodsMap.containsKey(methSig)) {
 MethodNode methNode = ifaceMethodsMap.get(methSig);
-result.put(methSig, methNode);
+methodsMap.put(methSig, methNode);
 }
 }
 }
-
-// And add in the methods implemented in this class.
-for (MethodNode method : getMethods()) {
-String sig = method.getTypeDescriptor();
-result.put(sig, method);
-}
-return result;
 }
 
 public String getName() {

http://git-wip-us.apache.org/repos/asf/groovy/blob/df63a38d/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 47e3175..c29c705 100644
--- a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
+++ b/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
@@ -84,33 +84,48 @@ public class ClassCompletionVerifier extends 
ClassCodeVisitorSupport {
 }
 
 private void checkNoStaticMethodWithSameSignatureAsNonStatic(final 
ClassNode node) {
-Map result = new HashMap();
-// add in unimplemented abstract methods from the interfaces
-for (ClassNode iface : node.getInterfaces()) {
-Map ifaceMethodsMap = 
iface.getDeclaredMethodsMap();
-for (String methSig : ifaceMethodsMap.keySet()) {
-if (!result.containsKey(methSig)) {
-MethodNode methNode = ifaceMethodsMap.get(methSig);
-result.put(methSig, methNode);
-}
-}
+ClassNode parent = node.getSuperClass();
+Map result;
+// start with methods from the parent if any
+if (parent != null) {
+result = parent.getDeclaredMethodsMap();
+} else {
+result = new HashMap();
 }
+// add in unimplemented abstract methods from the interfaces
+node.addInterfaceMethods(result);
 for (MethodNode methodNode : node.getMethods()) {
 MethodNode mn = result.get(methodNode.getTypeDescriptor());
-if (mn!=null && methodNode.isStatic() &

[1/2] groovy git commit: GROOVY-7620: No error if abstract getter is not implemented but static field exists (closes #342)

2016-05-31 Thread paulk
Repository: groovy
Updated Branches:
  refs/heads/master 4738970c6 -> 3d60dbd79


GROOVY-7620: No error if abstract getter is not implemented but static field 
exists (closes #342)


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

Branch: refs/heads/master
Commit: 973197fdb5e27df579f5ae9b918d3fa13213f482
Parents: 4738970
Author: paulk 
Authored: Tue May 31 21:14:54 2016 +1000
Committer: paulk 
Committed: Wed Jun 1 13:20:06 2016 +1000

--
 src/main/org/codehaus/groovy/ast/ClassNode.java | 23 ---
 .../classgen/ClassCompletionVerifier.java   | 71 +++-
 src/test/groovy/bugs/Groovy7081Bug.groovy   |  2 +-
 src/test/groovy/bugs/Groovy7620Bug.groovy   | 59 
 4 files changed, 114 insertions(+), 41 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/groovy/blob/973197fd/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 6601ac7..68ac22d 100644
--- a/src/main/org/codehaus/groovy/ast/ClassNode.java
+++ b/src/main/org/codehaus/groovy/ast/ClassNode.java
@@ -425,30 +425,33 @@ public class ClassNode extends AnnotatedNode implements 
Opcodes {
 public Map getDeclaredMethodsMap() {
 // Start off with the methods from the superclass.
 ClassNode parent = getSuperClass();
-Map result = null;
+Map result;
 if (parent != null) {
 result = parent.getDeclaredMethodsMap();
 } else {
 result = new HashMap();
 }
+addInterfaceMethods(result);
 
+// And add in the methods implemented in this class.
+for (MethodNode method : getMethods()) {
+String sig = method.getTypeDescriptor();
+result.put(sig, method);
+}
+return result;
+}
+
+public void addInterfaceMethods(Map methodsMap) {
 // add in unimplemented abstract methods from the interfaces
 for (ClassNode iface : getInterfaces()) {
 Map ifaceMethodsMap = 
iface.getDeclaredMethodsMap();
 for (String methSig : ifaceMethodsMap.keySet()) {
-if (!result.containsKey(methSig)) {
+if (!methodsMap.containsKey(methSig)) {
 MethodNode methNode = ifaceMethodsMap.get(methSig);
-result.put(methSig, methNode);
+methodsMap.put(methSig, methNode);
 }
 }
 }
-
-// And add in the methods implemented in this class.
-for (MethodNode method : getMethods()) {
-String sig = method.getTypeDescriptor();
-result.put(sig, method);
-}
-return result;
 }
 
 public String getName() {

http://git-wip-us.apache.org/repos/asf/groovy/blob/973197fd/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 47e3175..c29c705 100644
--- a/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
+++ b/src/main/org/codehaus/groovy/classgen/ClassCompletionVerifier.java
@@ -84,33 +84,48 @@ public class ClassCompletionVerifier extends 
ClassCodeVisitorSupport {
 }
 
 private void checkNoStaticMethodWithSameSignatureAsNonStatic(final 
ClassNode node) {
-Map result = new HashMap();
-// add in unimplemented abstract methods from the interfaces
-for (ClassNode iface : node.getInterfaces()) {
-Map ifaceMethodsMap = 
iface.getDeclaredMethodsMap();
-for (String methSig : ifaceMethodsMap.keySet()) {
-if (!result.containsKey(methSig)) {
-MethodNode methNode = ifaceMethodsMap.get(methSig);
-result.put(methSig, methNode);
-}
-}
+ClassNode parent = node.getSuperClass();
+Map result;
+// start with methods from the parent if any
+if (parent != null) {
+result = parent.getDeclaredMethodsMap();
+} else {
+result = new HashMap();
 }
+// add in unimplemented abstract methods from the interfaces
+node.addInterfaceMethods(result);
 for (MethodNode methodNode : node.getMethods()) {
 MethodNode mn = result.get(methodNode.getTypeDescriptor());
-if (mn!=null && methodNode.isStatic() && 
!methodNo