[java-dfa] ClassDef: remove isInheritor(superName); replace with other methods

GitOrigin-RevId: 0033d430c30b804d8afbac3ea80938ed1130d17d
This commit is contained in:
Tagir Valeev
2024-09-30 17:39:00 +02:00
committed by intellij-monorepo-bot
parent 1502820f0d
commit 4f112c52a7
4 changed files with 5 additions and 22 deletions

View File

@@ -325,7 +325,7 @@ public final class TypeConstraints {
if (equals(other)) return true;
if (other instanceof PrimitiveArray || other instanceof ExactArray || other instanceof Unresolved) return true;
if (other instanceof ExactClass exactClass) {
return exactClass.classDef.isInheritor(myReference);
return exactClass.isSubtypeOf(myReference);
}
if (other instanceof ExactSubclass subclass) {
for (Exact superClass : subclass.mySupers) {
@@ -444,7 +444,7 @@ public final class TypeConstraints {
if (other instanceof ArraySuperInterface) {
if (classDef.isInterface()) return true;
if (!classDef.isFinal()) return true;
return classDef.isInheritor(((ArraySuperInterface)other).myReference);
return isSubtypeOf(((ArraySuperInterface)other).myReference);
}
if (other instanceof ExactClass exactClass) {
return classDef.isConvertible(exactClass.classDef);
@@ -628,7 +628,6 @@ public final class TypeConstraints {
* in {@link #isInheritor(ClassDef)}, or in {@link #equals(Object)} calls).
*/
public interface ClassDef {
boolean isInheritor(@NotNull String superClassQualifiedName);
boolean isInheritor(@NotNull ClassDef superType);
boolean isConvertible(@NotNull ClassDef other);
boolean isInterface();
@@ -671,7 +670,7 @@ public final class TypeConstraints {
}
return unresolved(def.toString());
}
@NotNull Exact create(@NotNull String fqn);
}

View File

@@ -23,11 +23,6 @@ public class JavaClassDef implements TypeConstraints.ClassDef {
myClass = aClass;
}
@Override
public boolean isInheritor(@NotNull String superClassQualifiedName) {
return InheritanceUtil.isInheritor(myClass, superClassQualifiedName);
}
@Override
public boolean isInheritor(@NotNull TypeConstraints.ClassDef superType) {
return superType instanceof JavaClassDef && InheritanceUtil.isInheritorOrSelf(myClass, ((JavaClassDef)superType).myClass, true);