RuntimeType implements InferredType { @Override public boolean canBeOrExtend(String typeName) { return typeClass.canBeOrExtend(typeName); } 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_canBeOrExtend() { ClassSymbolImpl x = new ClassSymbolImpl("x", "x"); assertThat(new RuntimeType(x).canBeOrExtend("x")).isTrue(); assertThat(new RuntimeType(x).canBeOrExtend("y")).isFalse(); ClassSymbolImpl x1 = new ClassSymbolImpl("x1", "x1"); ClassSymbolImpl x2 = new ClassSymbolImpl("x2", "x2"); x2.addSuperClass(x1); assertThat(new RuntimeType(x2).canBeOrExtend("x1")).isTrue(); ClassSymbolImpl y = new ClassSymbolImpl("y", "y"); y.addSuperClass(new SymbolImpl("unknown", null)); assertThat(new RuntimeType(y).canBeOrExtend("z")).isTrue(); }