RuntimeType implements InferredType { @Override public boolean canHaveMember(String memberName) { return typeClass.canHaveMember(memberName); } 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 cycle_between_super_types() { ClassSymbolImpl x = new ClassSymbolImpl("x", "x"); ClassSymbolImpl y = new ClassSymbolImpl("y", "y"); ClassSymbolImpl z = new ClassSymbolImpl("z", "z"); x.addSuperClass(y); y.addSuperClass(z); z.addSuperClass(x); assertThat(new RuntimeType(x).canHaveMember("foo")).isFalse(); }
@Test public void unresolved_type_hierarchy() { ClassSymbolImpl x = new ClassSymbolImpl("x", "x"); x.setHasSuperClassWithoutSymbol(); assertThat(new RuntimeType(x).canHaveMember("foo")).isTrue(); ClassSymbolImpl y = new ClassSymbolImpl("y", "y"); y.addSuperClass(x); assertThat(new RuntimeType(y).canHaveMember("foo")).isTrue(); }