[FE] Add sealed classes related properties to java model
This commit is contained in:
committed by
TeamCityServer
parent
8e9e34350f
commit
bdfb71b149
+6
@@ -59,6 +59,12 @@ class JavaClassImpl(psiClass: PsiClass) : JavaClassifierImpl<PsiClass>(psiClass)
|
||||
override val isEnum: Boolean
|
||||
get() = psi.isEnum
|
||||
|
||||
override val isSealed: Boolean
|
||||
get() = JavaElementUtil.isSealed(this)
|
||||
|
||||
override val permittedTypes: Collection<JavaClassifierType>
|
||||
get() = classifierTypes(psi.permitsListTypes)
|
||||
|
||||
override val isRecord: Boolean
|
||||
get() = psi.isRecord
|
||||
|
||||
|
||||
+4
@@ -52,6 +52,10 @@ import static org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectio
|
||||
return owner.getPsi().hasModifierProperty(PsiModifier.FINAL);
|
||||
}
|
||||
|
||||
public static boolean isSealed(@NotNull JavaModifierListOwnerImpl owner) {
|
||||
return owner.getPsi().hasModifierProperty(PsiModifier.SEALED);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Visibility getVisibility(@NotNull JavaModifierListOwnerImpl owner) {
|
||||
PsiModifierListOwner psiOwner = owner.getPsi();
|
||||
|
||||
+7
@@ -70,6 +70,9 @@ class BinaryJavaClass(
|
||||
|
||||
override val lightClassOriginKind: LightClassOriginKind? get() = null
|
||||
|
||||
override val isSealed: Boolean get() = permittedTypes.isNotEmpty()
|
||||
override val permittedTypes = arrayListOf<JavaClassifierType>()
|
||||
|
||||
override fun isFromSourceCodeInScope(scope: SearchScope): Boolean = false
|
||||
|
||||
override fun visitEnd() {
|
||||
@@ -233,4 +236,8 @@ class BinaryJavaClass(
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
override fun visitPermittedSubtypeExperimental(permittedSubtype: String?) {
|
||||
permittedTypes.addIfNotNull(permittedSubtype?.convertInternalNameToClassifierType())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user