mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 03:21:12 +07:00
[java-dfa] ClassDef: remove isInheritor(superName); replace with other methods
GitOrigin-RevId: 0033d430c30b804d8afbac3ea80938ed1130d17d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1502820f0d
commit
4f112c52a7
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -33,15 +33,8 @@ class KtClassDef(
|
||||
private val kind: KaClassKind,
|
||||
private val modality: KaSymbolModality?
|
||||
) : TypeConstraints.ClassDef {
|
||||
override fun isInheritor(superClassQualifiedName: String): Boolean =
|
||||
analyze(module) {
|
||||
val classLikeSymbol = pointer.restoreSymbol() ?: return@analyze false
|
||||
((classLikeSymbol as? KaNamedClassSymbol)?.defaultType?.allSupertypes ?: emptySequence()).any { superType ->
|
||||
(superType as? KaClassType)?.expandedSymbol?.classId?.asFqNameString() == superClassQualifiedName
|
||||
}
|
||||
}
|
||||
|
||||
override fun isInheritor(superType: TypeConstraints.ClassDef): Boolean =
|
||||
override fun isInheritor(superType: TypeConstraints.ClassDef): Boolean =
|
||||
superType is KtClassDef && analyze(module) {
|
||||
val classLikeSymbol = pointer.restoreSymbol() ?: return@analyze false
|
||||
val superSymbol = superType.pointer.restoreSymbol() ?: return@analyze false
|
||||
|
||||
@@ -28,12 +28,8 @@ import java.util.stream.Stream
|
||||
import kotlin.streams.asStream
|
||||
|
||||
class KtClassDef(val cls: ClassDescriptor) : TypeConstraints.ClassDef {
|
||||
override fun isInheritor(superClassQualifiedName: String): Boolean =
|
||||
cls.getAllSuperClassifiers().any { superClass ->
|
||||
superClass is ClassDescriptor && correctFqName(superClass.fqNameUnsafe) == superClassQualifiedName
|
||||
}
|
||||
|
||||
override fun isInheritor(superType: TypeConstraints.ClassDef): Boolean =
|
||||
override fun isInheritor(superType: TypeConstraints.ClassDef): Boolean =
|
||||
superType is KtClassDef && cls.isSubclassOf(superType.cls)
|
||||
|
||||
override fun isConvertible(other: TypeConstraints.ClassDef): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user