Skip to content

Commit 1964d20

Browse files
committed
Refactor equals and hashcode for Method
1 parent d77a1a4 commit 1964d20

File tree

1 file changed

+2
-6
lines changed
  • swan-pipeline/src/main/java/de/fraunhofer/iem/swan/data

1 file changed

+2
-6
lines changed

swan-pipeline/src/main/java/de/fraunhofer/iem/swan/data/Method.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,13 @@ public boolean equals(Object another) {
383383
return false;
384384
Method otherMethod = (Method) another;
385385

386-
if (!this.name.equals(otherMethod.name))
387-
return false;
388-
if (!this.parameters.equals(otherMethod.parameters))
389-
return false;
390-
return this.getClassName().equals(otherMethod.getClassName());
386+
return this.getSignature().equals(otherMethod.getSignature());
391387
}
392388

393389
@Override
394390
public int hashCode() {
395391
if (this.hashCode == 0)
396-
this.hashCode = this.name.hashCode() * 5;
392+
this.hashCode = this.getSignature().hashCode() * 5;
397393
// The parameter list is available from the outside, so we can't cache it
398394
return this.hashCode + this.parameters.hashCode() * 7;
399395
}

0 commit comments

Comments
 (0)