Skip to content

Commit

Permalink
GROOVY-10249 (pt.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-milles committed Oct 2, 2021
1 parent 1c7dd66 commit 97e2b0f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,14 +775,19 @@ public void addInterface(ClassNode type) {
}
}

public boolean equals(Object o) {
// GRECLIPSE add
if (o==null) return false;
// GRECLIPSE end
public boolean equals(final Object that) {
/* GRECLIPSE edit -- GROOVY-10249, et al.
if (redirect!=null) return redirect().equals(o);
if (!(o instanceof ClassNode)) return false;
ClassNode cn = (ClassNode) o;
return (cn.getText().equals(getText()));
*/
if (that == this) return true;
if (!(that instanceof ClassNode)) return false;
if (redirect != null) return redirect.equals(that);
if (componentType != null) return componentType.equals(((ClassNode) that).componentType);
return ((ClassNode) that).getText().equals(getText()); // arrays could be "T[]" or "[LT;"
// GRECLIPSE end
}

public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,8 @@ public boolean equals(Object that) {
if (that == this) return true;
if (!(that instanceof ClassNode)) return false;
if (redirect != null) return redirect.equals(that);
return (((ClassNode) that).getText().equals(getText()));
if (componentType != null) return componentType.equals(((ClassNode) that).componentType);
return ((ClassNode) that).getText().equals(getText()); // arrays could be "T[]" or "[LT;"
}

public int hashCode() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,8 @@ public boolean equals(Object that) {
if (that == this) return true;
if (!(that instanceof ClassNode)) return false;
if (redirect != null) return redirect.equals(that);
return (((ClassNode) that).getText().equals(getText()));
if (componentType != null) return componentType.equals(((ClassNode) that).componentType);
return ((ClassNode) that).getText().equals(getText()); // arrays could be "T[]" or "[LT;"
}

@Override
Expand Down

0 comments on commit 97e2b0f

Please sign in to comment.