[SLC] Fix modifiers for @JvmStatic methods in interfaces
This commit is contained in:
committed by
Space Team
parent
253cdb1b8f
commit
9204f8162e
+1
-1
@@ -13,5 +13,5 @@ import org.jetbrains.kotlin.light.classes.symbol.classes.SymbolLightClassBase
|
|||||||
|
|
||||||
context(KtAnalysisSession)
|
context(KtAnalysisSession)
|
||||||
internal fun String.isSuppressedFinalModifier(containingClass: SymbolLightClassBase, symbol: KtCallableSymbol): Boolean {
|
internal fun String.isSuppressedFinalModifier(containingClass: SymbolLightClassBase, symbol: KtCallableSymbol): Boolean {
|
||||||
return this == PsiModifier.FINAL && containingClass.isEnum && symbol.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED
|
return this == PsiModifier.FINAL && (containingClass.isEnum && symbol.origin == KtSymbolOrigin.SOURCE_MEMBER_GENERATED || containingClass.isInterface)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -23,7 +23,7 @@ internal class SymbolLightMemberModifierList<T : KtLightMember<*>>(
|
|||||||
override fun hasModifierProperty(name: String): Boolean = when {
|
override fun hasModifierProperty(name: String): Boolean = when {
|
||||||
name == PsiModifier.ABSTRACT && isImplementationInInterface() -> false
|
name == PsiModifier.ABSTRACT && isImplementationInInterface() -> false
|
||||||
// Pretend this method behaves like a `default` method
|
// Pretend this method behaves like a `default` method
|
||||||
name == PsiModifier.DEFAULT && isImplementationInInterface() -> true
|
name == PsiModifier.DEFAULT && isImplementationInInterface() && !hasModifierProperty(PsiModifier.STATIC) -> true
|
||||||
// TODO: FINAL && isPossiblyAffectedByAllOpen
|
// TODO: FINAL && isPossiblyAffectedByAllOpen
|
||||||
else -> super.hasModifierProperty(name)
|
else -> super.hasModifierProperty(name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,10 +39,10 @@ private class KtUltraLightMethodModifierList(
|
|||||||
owner: KtUltraLightMethod,
|
owner: KtUltraLightMethod,
|
||||||
val delegate: PsiMethod,
|
val delegate: PsiMethod,
|
||||||
) : KtUltraLightModifierList<KtUltraLightMethod>(owner, support) {
|
) : KtUltraLightModifierList<KtUltraLightMethod>(owner, support) {
|
||||||
override fun hasModifierProperty(name: String) = when {
|
override fun hasModifierProperty(name: String): Boolean = when {
|
||||||
name == PsiModifier.ABSTRACT && isImplementationInInterface() -> false
|
name == PsiModifier.ABSTRACT && isImplementationInInterface() -> false
|
||||||
// pretend this method behaves like a default method
|
// pretend this method behaves like a default method
|
||||||
name == PsiModifier.DEFAULT && isImplementationInInterface() -> true
|
name == PsiModifier.DEFAULT && isImplementationInInterface() && !hasModifierProperty(PsiModifier.STATIC) -> true
|
||||||
name == PsiModifier.FINAL &&
|
name == PsiModifier.FINAL &&
|
||||||
(owner.containingClass.safeAs<KtLightClassForSourceDeclaration>()?.isPossiblyAffectedByAllOpen() == true)
|
(owner.containingClass.safeAs<KtLightClassForSourceDeclaration>()?.isPossiblyAffectedByAllOpen() == true)
|
||||||
-> delegate.hasModifierProperty(name)
|
-> delegate.hasModifierProperty(name)
|
||||||
|
|||||||
@@ -7,6 +7,31 @@ public final class A /* A*/ {
|
|||||||
|
|
||||||
public A();// .ctor()
|
public A();// .ctor()
|
||||||
|
|
||||||
|
public static abstract interface I /* A.I*/ {
|
||||||
|
@org.jetbrains.annotations.NotNull()
|
||||||
|
public static final A.I.Companion Companion;
|
||||||
|
|
||||||
|
@kotlin.jvm.JvmStatic()
|
||||||
|
public static void h();// h()
|
||||||
|
|
||||||
|
public static final class C /* A.I.C*/ {
|
||||||
|
@org.jetbrains.annotations.NotNull()
|
||||||
|
public static final A.I.C INSTANCE;
|
||||||
|
|
||||||
|
@kotlin.jvm.JvmStatic()
|
||||||
|
public static final void i();// i()
|
||||||
|
|
||||||
|
private C();// .ctor()
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final class Companion /* A.I.Companion*/ {
|
||||||
|
@kotlin.jvm.JvmStatic()
|
||||||
|
public final void h();// h()
|
||||||
|
|
||||||
|
private Companion();// .ctor()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static final class B /* A.B*/ {
|
public static final class B /* A.B*/ {
|
||||||
@org.jetbrains.annotations.NotNull()
|
@org.jetbrains.annotations.NotNull()
|
||||||
public static final A.B INSTANCE;
|
public static final A.B INSTANCE;
|
||||||
|
|||||||
@@ -3,15 +3,21 @@
|
|||||||
|
|
||||||
class A {
|
class A {
|
||||||
companion object {
|
companion object {
|
||||||
@JvmStatic fun f() {
|
@JvmStatic fun f() { }
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
object B {
|
object B {
|
||||||
@JvmStatic
|
@JvmStatic fun g() { }
|
||||||
fun g() {
|
}
|
||||||
|
|
||||||
|
interface I {
|
||||||
|
companion object {
|
||||||
|
@JvmStatic fun h() { }
|
||||||
|
}
|
||||||
|
|
||||||
|
object C {
|
||||||
|
@JvmStatic
|
||||||
|
fun i() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user