Private visibility for non-const, non-jvmField class companion property backing field
This commit is contained in:
@@ -39,6 +39,7 @@ import org.jetbrains.kotlin.lexer.KtTokens;
|
||||
import org.jetbrains.kotlin.load.java.JavaVisibilities;
|
||||
import org.jetbrains.kotlin.load.java.JvmAnnotationNames;
|
||||
import org.jetbrains.kotlin.name.FqName;
|
||||
import org.jetbrains.kotlin.platform.JavaToKotlinClassMap;
|
||||
import org.jetbrains.kotlin.resolve.DeprecationUtilKt;
|
||||
import org.jetbrains.kotlin.resolve.DescriptorUtils;
|
||||
import org.jetbrains.kotlin.resolve.annotations.AnnotationUtilKt;
|
||||
@@ -61,6 +62,7 @@ import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isBoolean;
|
||||
import static org.jetbrains.kotlin.builtins.KotlinBuiltIns.isPrimitiveClass;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConstOrHasJvmFieldAnnotation;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface;
|
||||
import static org.jetbrains.kotlin.load.java.JvmAnnotationNames.KOTLIN_SYNTHETIC_CLASS;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
@@ -681,13 +683,13 @@ public class AsmUtil {
|
||||
isObject(propertyDescriptor.getContainingDeclaration());
|
||||
}
|
||||
|
||||
public static int getVisibilityForSpecialPropertyBackingField(@NotNull PropertyDescriptor propertyDescriptor, boolean isDelegate) {
|
||||
public static int getVisibilityForBackingField(@NotNull PropertyDescriptor propertyDescriptor, boolean isDelegate) {
|
||||
boolean isExtensionProperty = propertyDescriptor.getExtensionReceiverParameter() != null;
|
||||
if (isDelegate || isExtensionProperty) {
|
||||
return ACC_PRIVATE;
|
||||
}
|
||||
else {
|
||||
return areBothAccessorDefault(propertyDescriptor)
|
||||
return propertyDescriptor.isLateInit() || isConstOrHasJvmFieldAnnotation(propertyDescriptor)
|
||||
? getVisibilityAccessFlag(descriptorForVisibility(propertyDescriptor))
|
||||
: ACC_PRIVATE;
|
||||
}
|
||||
@@ -706,16 +708,7 @@ public class AsmUtil {
|
||||
DeclarationDescriptor propertyContainer = propertyDescriptor.getContainingDeclaration();
|
||||
return propertyDescriptor.isConst()
|
||||
&& isCompanionObject(propertyContainer) && isInterface(propertyContainer.getContainingDeclaration())
|
||||
&& getVisibilityForSpecialPropertyBackingField(propertyDescriptor, false) == ACC_PUBLIC;
|
||||
}
|
||||
|
||||
private static boolean areBothAccessorDefault(@NotNull PropertyDescriptor propertyDescriptor) {
|
||||
return isAccessorWithEmptyBody(propertyDescriptor.getGetter())
|
||||
&& (!propertyDescriptor.isVar() || isAccessorWithEmptyBody(propertyDescriptor.getSetter()));
|
||||
}
|
||||
|
||||
private static boolean isAccessorWithEmptyBody(@Nullable PropertyAccessorDescriptor accessorDescriptor) {
|
||||
return accessorDescriptor == null || !accessorDescriptor.hasBody();
|
||||
&& getVisibilityForBackingField(propertyDescriptor, false) == ACC_PUBLIC;
|
||||
}
|
||||
|
||||
public static Type comparisonOperandType(Type left, Type right) {
|
||||
|
||||
@@ -2140,7 +2140,7 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
|
||||
|
||||
PropertyDescriptor originalPropertyDescriptor = DescriptorUtils.unwrapFakeOverride(propertyDescriptor);
|
||||
if (fieldAccessorKind != FieldAccessorKind.NORMAL) {
|
||||
int flags = AsmUtil.getVisibilityForSpecialPropertyBackingField(propertyDescriptor, isDelegatedProperty);
|
||||
int flags = AsmUtil.getVisibilityForBackingField(propertyDescriptor, isDelegatedProperty);
|
||||
skipPropertyAccessors = (flags & ACC_PRIVATE) == 0 || skipAccessorsForPrivateFieldInOuterClass;
|
||||
if (!skipPropertyAccessors) {
|
||||
//noinspection ConstantConditions
|
||||
|
||||
@@ -54,12 +54,14 @@ import org.jetbrains.org.objectweb.asm.commons.Method;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.*;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.getDeprecatedAccessFlag;
|
||||
import static org.jetbrains.kotlin.codegen.AsmUtil.getVisibilityForBackingField;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConstOrHasJvmFieldAnnotation;
|
||||
import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isJvmInterface;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.FIELD_FOR_PROPERTY;
|
||||
import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.SYNTHETIC_METHOD_FOR_PROPERTY;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.*;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isCompanionObject;
|
||||
import static org.jetbrains.kotlin.resolve.DescriptorUtils.isInterface;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.K_PROPERTY_TYPE;
|
||||
import static org.jetbrains.kotlin.resolve.jvm.annotations.AnnotationUtilKt.hasJvmFieldAnnotation;
|
||||
import static org.jetbrains.org.objectweb.asm.Opcodes.*;
|
||||
@@ -300,50 +302,17 @@ public class PropertyCodegen {
|
||||
|
||||
ClassBuilder builder = v;
|
||||
|
||||
boolean hasJvmFieldAnnotation = hasJvmFieldAnnotation(propertyDescriptor);
|
||||
|
||||
FieldOwnerContext backingFieldContext = context;
|
||||
boolean takeVisibilityFromDescriptor = propertyDescriptor.isLateInit() || propertyDescriptor.isConst();
|
||||
boolean takeVisibilityFromSetter = propertyDescriptor.isLateInit() && propertyDescriptor.getSetter() != null;
|
||||
if (AsmUtil.isInstancePropertyWithStaticBackingField(propertyDescriptor) ) {
|
||||
modifiers |= ACC_STATIC;
|
||||
|
||||
if (takeVisibilityFromDescriptor) {
|
||||
modifiers |= getVisibilityAccessFlag(propertyDescriptor);
|
||||
}
|
||||
else if (hasJvmFieldAnnotation && !isDelegate) {
|
||||
modifiers |= getDefaultVisibilityFlag(propertyDescriptor.getVisibility());
|
||||
}
|
||||
else {
|
||||
modifiers |= getVisibilityForSpecialPropertyBackingField(propertyDescriptor, isDelegate);
|
||||
}
|
||||
|
||||
if (JvmAbi.isPropertyWithBackingFieldInOuterClass(propertyDescriptor)) {
|
||||
ImplementationBodyCodegen codegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
|
||||
builder = codegen.v;
|
||||
backingFieldContext = codegen.context;
|
||||
}
|
||||
|
||||
if (isObject(propertyDescriptor.getContainingDeclaration()) &&
|
||||
!hasJvmFieldAnnotation &&
|
||||
!propertyDescriptor.isConst() &&
|
||||
(modifiers & ACC_PRIVATE) == 0) {
|
||||
modifiers |= ACC_DEPRECATED;
|
||||
}
|
||||
}
|
||||
else if (takeVisibilityFromSetter) {
|
||||
// For lateinits, we take visibility from setter, if any
|
||||
modifiers |= getVisibilityAccessFlag(propertyDescriptor.getSetter());
|
||||
}
|
||||
else if (takeVisibilityFromDescriptor) {
|
||||
modifiers |= getVisibilityAccessFlag(propertyDescriptor);
|
||||
}
|
||||
else if (!isDelegate && hasJvmFieldAnnotation) {
|
||||
modifiers |= getDefaultVisibilityFlag(propertyDescriptor.getVisibility());
|
||||
}
|
||||
else {
|
||||
modifiers |= ACC_PRIVATE;
|
||||
}
|
||||
modifiers |= getVisibilityForBackingField(propertyDescriptor, isDelegate);
|
||||
|
||||
if (AsmUtil.isPropertyWithBackingFieldCopyInOuterClass(propertyDescriptor)) {
|
||||
ImplementationBodyCodegen parentBodyCodegen = (ImplementationBodyCodegen) memberCodegen.getParentCodegen();
|
||||
|
||||
@@ -55,7 +55,7 @@ public class FunctionDescriptorUtil {
|
||||
@NotNull FunctionDescriptor functionDescriptor,
|
||||
@NotNull List<KotlinType> typeArguments
|
||||
) {
|
||||
if (functionDescriptor.getTypeParameters().isEmpty()) return TypeSubstitution.getEMPTY();
|
||||
if (functionDescriptor.getTypeParameters().isEmpty()) return TypeSubstitution.EMPTY;
|
||||
|
||||
return new IndexedParametersSubstitution(functionDescriptor.getTypeParameters(), TypeUtilsKt.defaultProjections(typeArguments));
|
||||
}
|
||||
|
||||
+1
-4
@@ -1,9 +1,6 @@
|
||||
public final class ClassObjectField {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
@org.jetbrains.annotations.Nullable
|
||||
public static final java.lang.String x = "";
|
||||
private static final java.lang.String x = "";
|
||||
private static final java.lang.String y = "";
|
||||
public static final ClassObjectField.Companion Companion;
|
||||
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
public final class A {
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static final int c = 1;
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
private static final int c = 1;
|
||||
@org.jetbrains.annotations.NotNull
|
||||
public static java.lang.String v;
|
||||
private static java.lang.String v;
|
||||
public static final pack.A INSTANCE;
|
||||
|
||||
public final int getC() { /* compiled code */ }
|
||||
|
||||
@@ -3,8 +3,8 @@ class Test {
|
||||
return A.foo;
|
||||
}
|
||||
|
||||
public static String bar() {
|
||||
return A.bar;
|
||||
public static String constBar() {
|
||||
return A.constBar;
|
||||
}
|
||||
|
||||
public static String getBar() {
|
||||
|
||||
+4
-2
@@ -3,7 +3,9 @@ import kotlin.jvm.JvmStatic
|
||||
enum class A {
|
||||
;
|
||||
companion object {
|
||||
val foo: String = "OK"
|
||||
@JvmField val foo: String = "OK"
|
||||
|
||||
const val constBar: String = "OK"
|
||||
|
||||
@JvmStatic val bar: String = "OK"
|
||||
|
||||
@@ -13,7 +15,7 @@ enum class A {
|
||||
|
||||
fun box(): String {
|
||||
if (Test.foo() != "OK") return "Fail foo"
|
||||
if (Test.bar() != "OK") return "Fail bar"
|
||||
if (Test.constBar() != "OK") return "Fail bar"
|
||||
if (Test.getBar() != "OK") return "Fail getBar"
|
||||
if (Test.baz() != "OK") return "Fail baz"
|
||||
return "OK"
|
||||
|
||||
Vendored
+2
-2
@@ -1,7 +1,7 @@
|
||||
class KotlinClass {
|
||||
companion object {
|
||||
val FOO_INT: Int = 10
|
||||
val FOO_STRING: String = "OK"
|
||||
const val FOO_INT: Int = 10
|
||||
@JvmField val FOO_STRING: String = "OK"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -5,12 +5,18 @@ class Test {
|
||||
s = Klass.NAME;
|
||||
if (!s.equals("Klass")) throw new AssertionError("Fail class: " + s);
|
||||
|
||||
s = Klass.JVM_NAME;
|
||||
if (!s.equals("JvmKlass")) throw new AssertionError("Fail jvm class: " + s);
|
||||
|
||||
s = Trait.NAME;
|
||||
if (!s.equals("Trait")) throw new AssertionError("Fail interface: " + s);
|
||||
|
||||
s = Enoom.NAME;
|
||||
if (!s.equals("Enum")) throw new AssertionError("Fail enum: " + s);
|
||||
|
||||
s = Enoom.JVM_NAME;
|
||||
if (!s.equals("JvmEnum")) throw new AssertionError("Fail jvm enum: " + s);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-1
@@ -1,6 +1,7 @@
|
||||
class Klass {
|
||||
companion object {
|
||||
val NAME = "Klass"
|
||||
const val NAME = "Klass"
|
||||
@JvmField val JVM_NAME = "JvmKlass"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +15,7 @@ enum class Enoom {
|
||||
;
|
||||
companion object {
|
||||
const val NAME = "Enum"
|
||||
@JvmField val JVM_NAME = "JvmEnum"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ public interface ErrorsJvmTrait {
|
||||
|
||||
public class ErrorsJvmClass {
|
||||
companion object {
|
||||
public val param : G<String> = G("STRING")
|
||||
@JvmField public val param : G<String> = G("STRING")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,13 +11,13 @@ annotation class AFloat(val value: Float)
|
||||
class Test {
|
||||
|
||||
companion object {
|
||||
val vstring: String = "Test"
|
||||
val vchar: Char = 'c'
|
||||
val vint: Int = 10
|
||||
val vbyte: Byte = 11
|
||||
val vlong: Long = 12
|
||||
val vdouble: Double = 1.2
|
||||
val vfloat: Float = 1.3.toFloat()
|
||||
const val vstring: String = "Test"
|
||||
const val vchar: Char = 'c'
|
||||
const val vint: Int = 10
|
||||
const val vbyte: Byte = 11
|
||||
const val vlong: Long = 12
|
||||
const val vdouble: Double = 1.2
|
||||
const val vfloat: Float = 1.3.toFloat()
|
||||
}
|
||||
|
||||
}
|
||||
+7
-7
@@ -44,12 +44,12 @@ public final class Test {
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
public final val vbyte: kotlin.Byte
|
||||
public final val vchar: kotlin.Char
|
||||
public final val vdouble: kotlin.Double
|
||||
public final val vfloat: kotlin.Float
|
||||
public final val vint: kotlin.Int
|
||||
public final val vlong: kotlin.Long
|
||||
public final val vstring: kotlin.String
|
||||
public const final val vbyte: kotlin.Byte
|
||||
public const final val vchar: kotlin.Char
|
||||
public const final val vdouble: kotlin.Double
|
||||
public const final val vfloat: kotlin.Float
|
||||
public const final val vint: kotlin.Int
|
||||
public const final val vlong: kotlin.Long
|
||||
public const final val vstring: kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,6 @@ package test
|
||||
|
||||
class KotlinClass {
|
||||
companion object {
|
||||
val FOO: Int = 10
|
||||
const val FOO: Int = 10
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ public final class KotlinClass {
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
public final val FOO: kotlin.Int
|
||||
public const final val FOO: kotlin.Int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -3,9 +3,9 @@ package test
|
||||
class Test {
|
||||
|
||||
companion object {
|
||||
public val valProp: Int = 10
|
||||
public const val valProp: Int = 10
|
||||
|
||||
public var varProp: Int = 10
|
||||
@JvmField public var varProp: Int = 10
|
||||
}
|
||||
|
||||
}
|
||||
+2
-2
@@ -5,8 +5,8 @@ public final class Test {
|
||||
|
||||
public companion object Companion {
|
||||
private constructor Companion()
|
||||
public final val valProp: kotlin.Int
|
||||
public final var varProp: kotlin.Int
|
||||
public const final val valProp: kotlin.Int
|
||||
@field:kotlin.jvm.JvmField() public final var varProp: kotlin.Int
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class Test {
|
||||
companion object {
|
||||
var prop: Int = 0;
|
||||
const val prop: Int = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
@@ -6,7 +6,7 @@ class Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PRIVATE
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class Test {
|
||||
companion object {
|
||||
protected val prop: Int = 0;
|
||||
const protected val prop: Int = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PROTECTED, ACC_FINAL, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PROTECTED, ACC_FINAL
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class Test {
|
||||
companion object {
|
||||
public val prop: Int = 0;
|
||||
public const val prop: Int = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
@@ -6,7 +6,7 @@ class Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PRIVATE
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PROTECTED, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PRIVATE
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ class Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PRIVATE
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
class Test(val prop: String) {
|
||||
|
||||
companion object {
|
||||
public val prop : String = "CO";
|
||||
public const val prop : String = "CO";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,4 +13,4 @@ class Test(val prop: String) {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL
|
||||
+2
-2
@@ -3,7 +3,7 @@ class Test {
|
||||
public var prop: Int = 0;
|
||||
|
||||
companion object {
|
||||
public val prop: Int = 0;
|
||||
public const val prop: Int = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,4 @@ class Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL, ACC_DEPRECATED
|
||||
// FLAGS: ACC_STATIC, ACC_PUBLIC, ACC_FINAL
|
||||
@@ -10,4 +10,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_FINAL, ACC_STATIC
|
||||
@@ -10,4 +10,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_STATIC
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
interface Test {
|
||||
companion object {
|
||||
protected const val prop: Int = 0
|
||||
}
|
||||
}
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test, prop
|
||||
// ABSENT: TRUE
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PROTECTED, ACC_FINAL, ACC_STATIC
|
||||
@@ -10,4 +10,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PROTECTED, ACC_FINAL, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_FINAL, ACC_STATIC
|
||||
@@ -10,4 +10,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PUBLIC, ACC_FINAL, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_FINAL, ACC_STATIC
|
||||
@@ -10,4 +10,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_STATIC
|
||||
+1
-1
@@ -11,4 +11,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PROTECTED, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_STATIC
|
||||
|
||||
+1
-1
@@ -11,4 +11,4 @@ interface Test {
|
||||
|
||||
// TESTED_OBJECT_KIND: property
|
||||
// TESTED_OBJECTS: Test$Companion, prop
|
||||
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_DEPRECATED
|
||||
// FLAGS: ACC_PRIVATE, ACC_STATIC
|
||||
|
||||
@@ -875,6 +875,12 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("protectedConstVal.kt")
|
||||
public void testProtectedConstVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/writeFlags/property/classObject/trait/protectedConstVal.kt");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("protectedVal.kt")
|
||||
public void testProtectedVal() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/writeFlags/property/classObject/trait/protectedVal.kt");
|
||||
|
||||
@@ -240,7 +240,7 @@ public enum class DescriptorRendererModifier(val includeByDefault: Boolean) {
|
||||
;
|
||||
|
||||
companion object {
|
||||
val DEFAULTS = DescriptorRendererModifier.values().filter { it.includeByDefault }.toSet()
|
||||
val ALL = DescriptorRendererModifier.values().toSet()
|
||||
@JvmField val DEFAULTS = DescriptorRendererModifier.values().filter { it.includeByDefault }.toSet()
|
||||
@JvmField val ALL = DescriptorRendererModifier.values().toSet()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
||||
|
||||
public abstract class TypeSubstitution {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@JvmField
|
||||
public val EMPTY: TypeSubstitution = object : TypeSubstitution() {
|
||||
override fun get(key: KotlinType) = null
|
||||
override fun isEmpty() = true
|
||||
|
||||
@@ -32,10 +32,13 @@ fwBackingField.kt:62
|
||||
fwBackingField.kt:45
|
||||
fwBackingField.kt:48
|
||||
fwBackingField.kt:62
|
||||
fwBackingField.kt:42
|
||||
fwBackingField.kt:45
|
||||
fwBackingField.kt:51
|
||||
fwBackingField.kt:42
|
||||
fwBackingField.kt:48
|
||||
fwBackingField.kt:52
|
||||
fwBackingField.kt:42
|
||||
fwBackingField.kt:48
|
||||
fwBackingField.kt:54
|
||||
fwBackingField.kt:63
|
||||
|
||||
+12
@@ -892,6 +892,18 @@ public class ExperimentalIncrementalJpsTestGenerated extends AbstractExperimenta
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFieldChanged")
|
||||
public void testJvmFieldChanged() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/withJava/kotlinUsedInJava/jvmFieldChanged/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFieldUnchanged")
|
||||
public void testJvmFieldUnchanged() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/withJava/kotlinUsedInJava/jvmFieldUnchanged/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodAddedInSuper")
|
||||
public void testMethodAddedInSuper() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/withJava/kotlinUsedInJava/methodAddedInSuper/");
|
||||
|
||||
@@ -34,10 +34,18 @@ public class IncrementalConstantSearchTest : AbstractIncrementalJpsTest() {
|
||||
doTest("jps-plugin/testData/incremental/custom/kotlinConstantChangedUsedInJava/")
|
||||
}
|
||||
|
||||
fun testKotlinJvmFieldChangedUsedInJava() {
|
||||
doTest("jps-plugin/testData/incremental/custom/kotlinJvmFieldChangedUsedInJava/")
|
||||
}
|
||||
|
||||
fun testKotlinConstantUnchangedUsedInJava() {
|
||||
doTest("jps-plugin/testData/incremental/custom/kotlinConstantUnchangedUsedInJava/")
|
||||
}
|
||||
|
||||
fun testKotlinJvmFieldUnchangedUsedInJava() {
|
||||
doTest("jps-plugin/testData/incremental/custom/kotlinJvmFieldUnchangedUsedInJava/")
|
||||
}
|
||||
|
||||
override val mockConstantSearch: Callbacks.ConstantAffectionResolver?
|
||||
get() = object : Callbacks.ConstantAffectionResolver {
|
||||
override fun request(
|
||||
|
||||
@@ -892,6 +892,18 @@ public class IncrementalJpsTestGenerated extends AbstractIncrementalJpsTest {
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFieldChanged")
|
||||
public void testJvmFieldChanged() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/withJava/kotlinUsedInJava/jvmFieldChanged/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jvmFieldUnchanged")
|
||||
public void testJvmFieldUnchanged() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/withJava/kotlinUsedInJava/jvmFieldUnchanged/");
|
||||
doTest(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("methodAddedInSuper")
|
||||
public void testMethodAddedInSuper() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("jps-plugin/testData/incremental/withJava/kotlinUsedInJava/methodAddedInSuper/");
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ package test
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
val CONST = "BF"
|
||||
const val CONST = "BF"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ package test
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
val CONST = "Ae"
|
||||
const val CONST = "Ae"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
val CONST = "bar"
|
||||
const val CONST = "bar"
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*;
|
||||
|
||||
class Usage {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Klass.CONST + Klass.CONST);
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/Klass$Companion.class
|
||||
out/production/module/test/Klass.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/module/Usage.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Usage.java
|
||||
End of files
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
@JvmField
|
||||
val CONST = "BF"
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
@JvmField
|
||||
val CONST = "Ae"
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*;
|
||||
|
||||
class Usage {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Klass.CONST + Klass.CONST);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/Klass$Companion.class
|
||||
out/production/module/test/Klass.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
@JvmField
|
||||
val CONST = "bar"
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -3,6 +3,6 @@ package test
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
val CONST = "BF"
|
||||
const val CONST = "BF"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -3,6 +3,6 @@ package test
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
val CONST = "Ae"
|
||||
const val CONST = "Ae"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@ package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
val CONST = "bar"
|
||||
const val CONST = "bar"
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*;
|
||||
|
||||
class Usage {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Klass.CONST + Klass.CONST);
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/Klass$Companion.class
|
||||
out/production/module/test/Klass.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
Cleaning output files:
|
||||
out/production/module/Usage.class
|
||||
out/production/module/test/Klass$Companion.class
|
||||
out/production/module/test/Klass.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
Compiling files:
|
||||
src/Usage.java
|
||||
End of files
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
@JvmField
|
||||
val CONST = "BF"
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
// Old and new constant values are different, but their hashes are the same
|
||||
@JvmField
|
||||
val CONST = "Ae"
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
import test.*;
|
||||
|
||||
class Usage {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Klass.CONST + Klass.CONST);
|
||||
}
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
Cleaning output files:
|
||||
out/production/module/test/Klass$Companion.class
|
||||
out/production/module/test/Klass.class
|
||||
End of files
|
||||
Compiling files:
|
||||
src/const.kt
|
||||
End of files
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package test
|
||||
|
||||
class Klass {
|
||||
companion object {
|
||||
@JvmField
|
||||
val CONST = "bar"
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val login = 5
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val login = 5
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val login = 5
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val login = 5
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val login = 5
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val login = 5
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,15 +9,15 @@ import kotlinx.android.synthetic.main.layout1.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val item_detail_container = 0
|
||||
val textView1 = 1
|
||||
val password = 2
|
||||
val textView2 = 3
|
||||
val passwordConfirmation = 4
|
||||
val login = 5
|
||||
val passwordField = 6
|
||||
val passwordCaption = 7
|
||||
val loginButton = 8
|
||||
const val item_detail_container = 0
|
||||
const val textView1 = 1
|
||||
const val password = 2
|
||||
const val textView2 = 3
|
||||
const val passwordConfirmation = 4
|
||||
const val login = 5
|
||||
const val passwordField = 6
|
||||
const val passwordCaption = 7
|
||||
const val loginButton = 8
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ import kotlinx.android.synthetic.main.layout1.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val item_detail_container = 0
|
||||
val textView1 = 1
|
||||
val password = 2
|
||||
val textView2 = 3
|
||||
val passwordConfirmation = 4
|
||||
val login = 5
|
||||
const val item_detail_container = 0
|
||||
const val textView1 = 1
|
||||
const val password = 2
|
||||
const val textView2 = 3
|
||||
const val passwordConfirmation = 4
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val item_detail_container = 0
|
||||
val textView1 = 1
|
||||
val password = 2
|
||||
val textView2 = 3
|
||||
val passwordConfirmation = 4
|
||||
val login = 5
|
||||
const val item_detail_container = 0
|
||||
const val textView1 = 1
|
||||
const val password = 2
|
||||
const val textView2 = 3
|
||||
const val passwordConfirmation = 4
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,12 +8,12 @@ import kotlinx.android.synthetic.main.layout.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val item_detail_container = 0
|
||||
val textView1 = 1
|
||||
val password = 2
|
||||
val textView2 = 3
|
||||
val passwordConfirmation = 4
|
||||
val login = 5
|
||||
const val item_detail_container = 0
|
||||
const val textView1 = 1
|
||||
const val password = 2
|
||||
const val textView2 = 3
|
||||
const val passwordConfirmation = 4
|
||||
const val login = 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import kotlinx.android.synthetic.main.layout.view.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val container = 0
|
||||
val login = 1
|
||||
const val container = 0
|
||||
const val login = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import kotlinx.android.synthetic.main.layout.view.*
|
||||
class R {
|
||||
class id {
|
||||
companion object {
|
||||
val container = 0
|
||||
val login = 1
|
||||
const val container = 0
|
||||
const val login = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user