Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.8.2, 1.9-beta-3
-
Component/s: None
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
Currently, equals() generated by @EqualsAndHashCode looks like
class C {
String a, b
boolean equals(Object other) {
...
...
if(!(other instanceof C)) {return false}
if(this.a != other.a) {...}
if(this.b != other.b) {...}
...
}
}
It access getters/fields of enclosing class using type Object, which is not ideal and creates a little issue for static analysis done by Groovy++.
A slightly better implementation could be:
class C {
String a, b
boolean equals(Object other) {
...
...
if(!(other instanceof C)) {return false}
C another = (C) other
if(this.a != another.a) {...}
if(this.b != another.b) {...}
...
}
}
The patch attach has been reviewed on the "dev" mailing list.
Activity
Roshan Dawrani
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Status | Open [ 1 ] | Resolved [ 5 ] |
| Resolution | Fixed [ 1 ] |
Paul King
made changes -
| Fix Version/s | 1.9-beta-3 [ 17494 ] | |
| Fix Version/s | 1.8.2 [ 17495 ] |
Paul King
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |