RuntimeType implements InferredType { @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } RuntimeType that = (RuntimeType) o; return Objects.equals(typeClass.name(), that.typeClass.name()) && Objects.equals(typeClass.fullyQualifiedName(), that.typeClass.fullyQualifiedName()) && Objects.equals(typeClassSuperClassesFQN(), that.typeClassSuperClassesFQN()) && Objects.equals(typeClassMembersFQN(), that.typeClassMembersFQN()); } RuntimeType(ClassSymbol typeClass); @Override boolean isIdentityComparableWith(InferredType other); @Override boolean canHaveMember(String memberName); @Override boolean declaresMember(String memberName); @Override Optional<Symbol> resolveMember(String memberName); @Override Optional<Symbol> resolveDeclaredMember(String memberName); @Override boolean canOnlyBe(String typeName); @Override boolean canBeOrExtend(String typeName); @Override boolean isCompatibleWith(InferredType other); boolean mustBeOrExtend(String fullyQualifiedName); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); ClassSymbol getTypeClass();  }
@Test public void test_equals() { RuntimeType aType = new RuntimeType(a); assertThat(aType.equals(aType)).isTrue(); assertThat(aType.equals(new RuntimeType(a))).isTrue(); assertThat(aType.equals(new RuntimeType(b))).isFalse(); assertThat(aType.equals(a)).isFalse(); assertThat(aType.equals(null)).isFalse(); ClassSymbolImpl aWithSuperClass = new ClassSymbolImpl("a", "a"); aWithSuperClass.addSuperClass(b); RuntimeType aTypeWithSuperClass = new RuntimeType(aWithSuperClass); ClassSymbolImpl aWithSuperClass2 = new ClassSymbolImpl("a", "a"); aWithSuperClass2.addSuperClass(b); RuntimeType aTypeWithSuperClass2 = new RuntimeType(aWithSuperClass2); assertThat(aTypeWithSuperClass).isNotEqualTo(aType); assertThat(aTypeWithSuperClass).isEqualTo(aTypeWithSuperClass2); ClassSymbolImpl aWithMember = new ClassSymbolImpl("a", "a"); aWithMember.addMembers(Collections.singleton(new SymbolImpl("fn", "a.fn"))); RuntimeType aTypeWithMember = new RuntimeType(aWithMember); ClassSymbolImpl aWithMember2 = new ClassSymbolImpl("a", "a"); aWithMember2.addMembers(Collections.singleton(new SymbolImpl("fn", "a.fn"))); RuntimeType aTypeWithMember2 = new RuntimeType(aWithMember2); assertThat(aTypeWithMember).isNotEqualTo(aType); assertThat(aTypeWithMember).isEqualTo(aTypeWithMember2); RuntimeType x = new RuntimeType(new ClassSymbolImpl("X", null)); RuntimeType y = new RuntimeType(new ClassSymbolImpl("Y", null)); assertThat(x).isNotEqualTo(y); }