[AA LC] Fix visibility of fields from companion objects

^KTIJ-22541
This commit is contained in:
Dmitriy Novozhilov
2022-07-28 11:32:07 +03:00
parent c34f952126
commit 1ff51356b9
4 changed files with 18 additions and 35 deletions
@@ -135,7 +135,7 @@ internal abstract class SymbolLightClassForClassOrObject(
getDeclaredMemberScope().getCallableSymbols() getDeclaredMemberScope().getCallableSymbols()
.filterIsInstance<KtPropertySymbol>() .filterIsInstance<KtPropertySymbol>()
.applyIf(isInterface) { .applyIf(isInterface) {
filter { it.hasJvmFieldAnnotation() || it.isConst } filter { it.isConstOrJvmField }
} }
.mapTo(result) { .mapTo(result) {
SymbolLightFieldForProperty( SymbolLightFieldForProperty(
@@ -145,12 +145,15 @@ internal abstract class SymbolLightClassForClassOrObject(
lightMemberOrigin = null, lightMemberOrigin = null,
isTopLevel = false, isTopLevel = false,
forceStatic = true, forceStatic = true,
takePropertyVisibility = true takePropertyVisibility = it.isConstOrJvmField
) )
} }
} }
} }
private val KtPropertySymbol.isConstOrJvmField: Boolean
get() = isConst || hasJvmFieldAnnotation()
private val KtPropertySymbol.isConst: Boolean private val KtPropertySymbol.isConst: Boolean
get() = (this as? KtKotlinPropertySymbol)?.isConst == true get() = (this as? KtKotlinPropertySymbol)?.isConst == true
@@ -1,20 +0,0 @@
public final class ClassObjectField /* ClassObjectField*/ {
@org.jetbrains.annotations.NotNull()
public static final ClassObjectField.Companion Companion;
@org.jetbrains.annotations.Nullable()
private static final java.lang.String y;
@org.jetbrains.annotations.Nullable()
public static final java.lang.String x;
public ClassObjectField();// .ctor()
public static final class Companion /* ClassObjectField.Companion*/ {
@org.jetbrains.annotations.Nullable()
public final java.lang.String getX();// getX()
private Companion();// .ctor()
}}
@@ -1,17 +1,17 @@
public final class C /* C*/ { public final class C /* C*/ {
@kotlin.jvm.JvmStatic() @kotlin.jvm.JvmStatic()
@org.jetbrains.annotations.NotNull() @org.jetbrains.annotations.NotNull()
public static java.lang.String x; private static java.lang.String x;
@org.jetbrains.annotations.NotNull()
private static java.lang.String c1;
@org.jetbrains.annotations.NotNull()
private static java.lang.String c;
@org.jetbrains.annotations.NotNull() @org.jetbrains.annotations.NotNull()
public static final C.Companion Companion; public static final C.Companion Companion;
@org.jetbrains.annotations.NotNull()
public static java.lang.String c1;
@org.jetbrains.annotations.NotNull()
public static java.lang.String c;
@kotlin.jvm.JvmStatic() @kotlin.jvm.JvmStatic()
public static final void foo();// foo() public static final void foo();// foo()
@@ -74,18 +74,18 @@ public final class Foo /* Foo*/ {
private static final error.NonExistentClass contextBean; private static final error.NonExistentClass contextBean;
private static final int f1;
private static final int prop3;
private static int prop7;
protected java.lang.String protectedLateinitVar; protected java.lang.String protectedLateinitVar;
public error.NonExistentClass subject; public error.NonExistentClass subject;
public java.lang.String internalVarPrivateSet; public java.lang.String internalVarPrivateSet;
public static final int f1;
public static final int prop3;
public static int prop7;
@org.jetbrains.annotations.NotNull() @org.jetbrains.annotations.NotNull()
protected final java.lang.String getProtectedLateinitVar();// getProtectedLateinitVar() protected final java.lang.String getProtectedLateinitVar();// getProtectedLateinitVar()