Skip to content

Commit 97e2b0f

Browse files
committed
GROOVY-10249 (pt.2)
1 parent 1c7dd66 commit 97e2b0f

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

base/org.codehaus.groovy25/src/org/codehaus/groovy/ast/ClassNode.java

+9-4
Original file line numberDiff line numberDiff line change
@@ -775,14 +775,19 @@ public void addInterface(ClassNode type) {
775775
}
776776
}
777777

778-
public boolean equals(Object o) {
779-
// GRECLIPSE add
780-
if (o==null) return false;
781-
// GRECLIPSE end
778+
public boolean equals(final Object that) {
779+
/* GRECLIPSE edit -- GROOVY-10249, et al.
782780
if (redirect!=null) return redirect().equals(o);
783781
if (!(o instanceof ClassNode)) return false;
784782
ClassNode cn = (ClassNode) o;
785783
return (cn.getText().equals(getText()));
784+
*/
785+
if (that == this) return true;
786+
if (!(that instanceof ClassNode)) return false;
787+
if (redirect != null) return redirect.equals(that);
788+
if (componentType != null) return componentType.equals(((ClassNode) that).componentType);
789+
return ((ClassNode) that).getText().equals(getText()); // arrays could be "T[]" or "[LT;"
790+
// GRECLIPSE end
786791
}
787792

788793
public int hashCode() {

base/org.codehaus.groovy30/src/org/codehaus/groovy/ast/ClassNode.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,8 @@ public boolean equals(Object that) {
735735
if (that == this) return true;
736736
if (!(that instanceof ClassNode)) return false;
737737
if (redirect != null) return redirect.equals(that);
738-
return (((ClassNode) that).getText().equals(getText()));
738+
if (componentType != null) return componentType.equals(((ClassNode) that).componentType);
739+
return ((ClassNode) that).getText().equals(getText()); // arrays could be "T[]" or "[LT;"
739740
}
740741

741742
public int hashCode() {

base/org.codehaus.groovy40/src/org/codehaus/groovy/ast/ClassNode.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,8 @@ public boolean equals(Object that) {
766766
if (that == this) return true;
767767
if (!(that instanceof ClassNode)) return false;
768768
if (redirect != null) return redirect.equals(that);
769-
return (((ClassNode) that).getText().equals(getText()));
769+
if (componentType != null) return componentType.equals(((ClassNode) that).componentType);
770+
return ((ClassNode) that).getText().equals(getText()); // arrays could be "T[]" or "[LT;"
770771
}
771772

772773
@Override

0 commit comments

Comments
 (0)