-
-
Notifications
You must be signed in to change notification settings - Fork 78
Closed

Description
From SpotBugs:
The offending method:
@Override
public boolean equals(Object _o) {
return _o.getClass().equals(MethodTuple.class) && ((MethodTuple) _o).name.equals(this.name) && ((MethodTuple) _o).sig.equals(this.sig);
}
SpotBugs is correct, _o
needs a null
guard (by convention). The IDE generates the following code for hashCode
, equals
, and the constructor:
public MethodTuple(final String _name, final String _sig) {
name = _name;
sig = Objects.requireNonNullElse(_sig, "");
logger.trace("new MethodTuple({}, {})", name, sig);
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
final MethodTuple that = (MethodTuple) o;
return Objects.equals(name, that.name) && Objects.equals(sig, that.sig);
}
@Override
public int hashCode() {
return Objects.hash(name, sig);
}
Metadata
Metadata
Assignees
Labels
No labels