diff --git a/src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java b/src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java index 71240ae9..834fabb7 100644 --- a/src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java +++ b/src/main/java/de/dhbwstuttgart/syntaxtree/ClassOrInterface.java @@ -188,9 +188,8 @@ public class ClassOrInterface extends SyntaxTreeNode implements TypeScope { @Override public boolean equals(Object o) { if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - ClassOrInterface that = (ClassOrInterface) o; - return Objects.equals(name, that.name); + if (!(o instanceof ClassOrInterface other)) return false; + return Objects.equals(name, other.name); } @Override