RuntimeType implements InferredType { @Override public boolean isIdentityComparableWith(InferredType other) { if (other == AnyType.ANY || other instanceof DeclaredType) { return true; } if (other instanceof UnionType) { return other.isIdentityComparableWith(this); } return this.equals(other); } 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 isIdentityComparableWith() { RuntimeType aType = new RuntimeType(a); RuntimeType bType = new RuntimeType(b); RuntimeType cType = new RuntimeType(c); assertThat(aType.isIdentityComparableWith(bType)).isFalse(); assertThat(aType.isIdentityComparableWith(aType)).isTrue(); assertThat(aType.isIdentityComparableWith(new RuntimeType(a))).isTrue(); assertThat(aType.isIdentityComparableWith(AnyType.ANY)).isTrue(); assertThat(aType.isIdentityComparableWith(or(aType, bType))).isTrue(); assertThat(aType.isIdentityComparableWith(or(cType, bType))).isFalse(); assertThat(aType.isIdentityComparableWith(new DeclaredType(a))).isTrue(); assertThat(aType.isIdentityComparableWith(new DeclaredType(b))).isTrue(); }