Use getter names for $annotations methods in most codegen tests

This is needed to update master to 1.4, while still testing the latest
compiler by default. Also add one test on the old behavior.
This commit is contained in:
Alexander Udalov
2019-12-27 15:59:03 +01:00
parent 330dd789de
commit e2a42446ed
20 changed files with 63 additions and 33 deletions
@@ -1,4 +1,4 @@
// !LANGUAGE: -UseGetterNameForPropertyAnnotationsMethodOnJvm // !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
@Target(AnnotationTarget.PROPERTY) @Target(AnnotationTarget.PROPERTY)
annotation class AnnProperty annotation class AnnProperty
@@ -33,4 +33,4 @@ annotation class Anno
@Anno @Anno
val p2: Int = 4 val p2: Int = 4
get() = field get() = field
@@ -3,10 +3,10 @@ public final class A {
private final @AnnField @AnnParameterField @AnnTypeField field a: int private final @AnnField @AnnParameterField @AnnTypeField field a: int
private final @AnnField @AnnTypeField field x: int private final @AnnField @AnnTypeField field x: int
public method <init>(@AnnParameterProperty @AnnParameterField p0: int): void public method <init>(@AnnParameterProperty @AnnParameterField p0: int): void
public synthetic deprecated static @AnnProperty @AnnFieldProperty @AnnParameterProperty method a$annotations(): void public synthetic deprecated static @AnnProperty @AnnFieldProperty @AnnParameterProperty method getA$annotations(): void
public final method getA(): int public final method getA(): int
public synthetic deprecated static @AnnProperty @AnnFieldProperty method getX$annotations(): void
public final method getX(): int public final method getX(): int
public synthetic deprecated static @AnnProperty @AnnFieldProperty method x$annotations(): void
} }
@kotlin.annotation.Target @kotlin.annotation.Target
@@ -1,4 +1,4 @@
// !LANGUAGE: -UseGetterNameForPropertyAnnotationsMethodOnJvm // !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
import kotlin.reflect.KProperty import kotlin.reflect.KProperty
@@ -22,4 +22,4 @@ public class A(@AnnParam @field:AnnField @property:AnnProp2 val x: Int, @param:A
@AnnProp @property:AnnProp2 @delegate:AnnDelegate @property:AnnDelegate @AnnProp @property:AnnProp2 @delegate:AnnDelegate @property:AnnDelegate
val s: String by CustomDelegate() val s: String by CustomDelegate()
} }
@@ -7,15 +7,15 @@ public final class A {
private field y: int private field y: int
static method <clinit>(): void static method <clinit>(): void
public method <init>(@AnnParam p0: int, @AnnParam p1: int): void public method <init>(@AnnParam p0: int, @AnnParam p1: int): void
public synthetic deprecated static @AnnProp @AnnProp2 method getP$annotations(): void
public final @AnnGetter method getP(): int public final @AnnGetter method getP(): int
public synthetic deprecated static @AnnProp @AnnProp2 @AnnDelegate method getS$annotations(): void
public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String public final @org.jetbrains.annotations.NotNull method getS(): java.lang.String
public synthetic deprecated static @AnnProp2 method getX$annotations(): void
public final method getX(): int public final method getX(): int
public final @AnnGetter method getY(): int public final @AnnGetter method getY(): int
public synthetic deprecated static @AnnProp @AnnProp2 method p$annotations(): void
public synthetic deprecated static @AnnProp @AnnProp2 @AnnDelegate method s$annotations(): void
public final @AnnSetter method setP(@AnnParam p0: int): void public final @AnnSetter method setP(@AnnParam p0: int): void
public final @AnnSetter method setY(p0: int): void public final @AnnSetter method setY(p0: int): void
public synthetic deprecated static @AnnProp2 method x$annotations(): void
} }
@java.lang.annotation.Retention @java.lang.annotation.Retention
@@ -1,4 +1,4 @@
// !LANGUAGE: -UseGetterNameForPropertyAnnotationsMethodOnJvm // !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
// WITH_RUNTIME // WITH_RUNTIME
@file:[JvmName("Foo") JvmMultifileClass] @file:[JvmName("Foo") JvmMultifileClass]
@@ -6,7 +6,7 @@ public final class test/Foo {
@kotlin.Metadata @kotlin.Metadata
synthetic final class test/Foo__InlineOnlyPropertyMultifileKt { synthetic final class test/Foo__InlineOnlyPropertyMultifileKt {
public final static method foo(): void public final static method foo(): void
public synthetic deprecated static @kotlin.internal.InlineOnly method getProp$annotations(): void
private final static method getProp(): java.lang.String private final static method getProp(): java.lang.String
public synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void
private final static method setProp(p0: java.lang.String): void private final static method setProp(p0: java.lang.String): void
} }
@@ -1,4 +1,4 @@
// !LANGUAGE: -UseGetterNameForPropertyAnnotationsMethodOnJvm // !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
// WITH_RUNTIME // WITH_RUNTIME
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
@@ -1,18 +1,18 @@
@kotlin.Metadata @kotlin.Metadata
public final class Foo { public final class Foo {
public method <init>(): void public method <init>(): void
public synthetic deprecated static @kotlin.internal.InlineOnly method getProp$annotations(): void
private final method getProp(): java.lang.String private final method getProp(): java.lang.String
private final @kotlin.internal.InlineOnly method getProp2(): java.lang.String private final @kotlin.internal.InlineOnly method getProp2(): java.lang.String
public synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void
private final method setProp(p0: java.lang.String): void private final method setProp(p0: java.lang.String): void
public final method setProp2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void public final method setProp2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
} }
@kotlin.Metadata @kotlin.Metadata
public final class InlineOnlyPropertyKt { public final class InlineOnlyPropertyKt {
public synthetic deprecated static @kotlin.internal.InlineOnly method getProp$annotations(): void
private final static method getProp(): java.lang.String private final static method getProp(): java.lang.String
private final static @kotlin.internal.InlineOnly method getProp2(): java.lang.String private final static @kotlin.internal.InlineOnly method getProp2(): java.lang.String
public synthetic deprecated static @kotlin.internal.InlineOnly method prop$annotations(): void
private final static method setProp(p0: java.lang.String): void private final static method setProp(p0: java.lang.String): void
public final static method setProp2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void public final static method setProp2(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
} }
@@ -1,4 +1,4 @@
// !LANGUAGE: +InlineClasses -UseGetterNameForPropertyAnnotationsMethodOnJvm // !LANGUAGE: +InlineClasses +UseGetterNameForPropertyAnnotationsMethodOnJvm
interface IFoo { interface IFoo {
fun overridingFun() fun overridingFun()
@@ -77,4 +77,4 @@ inline class Z(@get:AGet val x: Int) : IFoo {
var @receiver:AReceiver String.nonOverridingExtVar: Int var @receiver:AReceiver String.nonOverridingExtVar: Int
get() = x get() = x
set(v) {} set(v) {}
} }
@@ -55,35 +55,35 @@ public final class Z {
public method equals(p0: java.lang.Object): boolean public method equals(p0: java.lang.Object): boolean
public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean public static method equals-impl(p0: int, @org.jetbrains.annotations.Nullable p1: java.lang.Object): boolean
public final static method equals-impl0(p0: int, p1: int): boolean public final static method equals-impl0(p0: int, p1: int): boolean
public synthetic deprecated static @A method getNonOverridingExtVal$annotations(p0: java.lang.String): void
public final static @AGet method getNonOverridingExtVal-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int public final static @AGet method getNonOverridingExtVal-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
public synthetic deprecated static @A method getNonOverridingExtVar$annotations(p0: java.lang.String): void
public final static @AGet method getNonOverridingExtVar-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int public final static @AGet method getNonOverridingExtVar-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
public synthetic deprecated static @A method getNonOverridingVal$annotations(): void
public final static @AGet method getNonOverridingVal-impl(p0: int): int public final static @AGet method getNonOverridingVal-impl(p0: int): int
public synthetic deprecated static @A method getNonOverridingVar$annotations(): void
public final static @AGet method getNonOverridingVar-impl(p0: int): int public final static @AGet method getNonOverridingVar-impl(p0: int): int
public synthetic deprecated static @A method getOverridingExtVal$annotations(p0: java.lang.String): void
public @AGet method getOverridingExtVal(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): int public @AGet method getOverridingExtVal(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): int
public static @AGet method getOverridingExtVal-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int public static @AGet method getOverridingExtVal-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
public synthetic deprecated static @A method getOverridingExtVar$annotations(p0: java.lang.String): void
public @AGet method getOverridingExtVar(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): int public @AGet method getOverridingExtVar(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): int
public static @AGet method getOverridingExtVar-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int public static @AGet method getOverridingExtVar-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): int
public synthetic deprecated static @A method getOverridingVal$annotations(): void
public @AGet method getOverridingVal(): int public @AGet method getOverridingVal(): int
public static @AGet method getOverridingVal-impl(p0: int): int public static @AGet method getOverridingVal-impl(p0: int): int
public synthetic deprecated static @A method getOverridingVar$annotations(): void
public @AGet method getOverridingVar(): int public @AGet method getOverridingVar(): int
public static @AGet method getOverridingVar-impl(p0: int): int public static @AGet method getOverridingVar-impl(p0: int): int
public final @AGet method getX(): int public final @AGet method getX(): int
public method hashCode(): int public method hashCode(): int
public static method hashCode-impl(p0: int): int public static method hashCode-impl(p0: int): int
public final static @A method nonOverridingExtFun-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): void public final static @A method nonOverridingExtFun-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): void
public synthetic deprecated static @A method nonOverridingExtVal$annotations(p0: java.lang.String): void
public synthetic deprecated static @A method nonOverridingExtVar$annotations(p0: java.lang.String): void
public final static @A method nonOverridingFun-impl(p0: int): void public final static @A method nonOverridingFun-impl(p0: int): void
public synthetic deprecated static @A method nonOverridingVal$annotations(): void
public synthetic deprecated static @A method nonOverridingVar$annotations(): void
public @A method overridingExtFun(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): void public @A method overridingExtFun(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String): void
public static @A method overridingExtFun-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): void public static @A method overridingExtFun-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String): void
public synthetic deprecated static @A method overridingExtVal$annotations(p0: java.lang.String): void
public synthetic deprecated static @A method overridingExtVar$annotations(p0: java.lang.String): void
public @A method overridingFun(): void public @A method overridingFun(): void
public static @A method overridingFun-impl(p0: int): void public static @A method overridingFun-impl(p0: int): void
public synthetic deprecated static @A method overridingVal$annotations(): void
public synthetic deprecated static @A method overridingVar$annotations(): void
public final static @ASet method setNonOverridingExtVar-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String, @ASetParam p2: int): void public final static @ASet method setNonOverridingExtVar-impl(p0: int, @AReceiver @org.jetbrains.annotations.NotNull p1: java.lang.String, @ASetParam p2: int): void
public final static @ASet method setNonOverridingVar-impl(p0: int, @ASetParam p1: int): void public final static @ASet method setNonOverridingVar-impl(p0: int, @ASetParam p1: int): void
public @ASet method setOverridingExtVar(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String, @ASetParam p1: int): void public @ASet method setOverridingExtVar(@AReceiver @org.jetbrains.annotations.NotNull p0: java.lang.String, @ASetParam p1: int): void
@@ -1,4 +1,4 @@
// !LANGUAGE: +MultiPlatformProjects -UseGetterNameForPropertyAnnotationsMethodOnJvm // !LANGUAGE: +MultiPlatformProjects +UseGetterNameForPropertyAnnotationsMethodOnJvm
// !USE_EXPERIMENTAL: kotlin.ExperimentalMultiplatform // !USE_EXPERIMENTAL: kotlin.ExperimentalMultiplatform
// TARGET_BACKEND: JVM // TARGET_BACKEND: JVM
// WITH_RUNTIME // WITH_RUNTIME
@@ -16,7 +16,7 @@ public final class Foo {
inner class Foo$Nested inner class Foo$Nested
public method <init>(p0: int): void public method <init>(p0: int): void
public final method bar(): void public final method bar(): void
public synthetic deprecated static method getX$annotations(): void
public final method getX(): int public final method getX(): int
public final method setX(p0: int): void public final method setX(p0: int): void
public synthetic deprecated static method x$annotations(): void
} }
@@ -1,4 +1,5 @@
// !JVM_DEFAULT_MODE: compatibility // !JVM_DEFAULT_MODE: compatibility
// !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
// WITH_RUNTIME // WITH_RUNTIME
@@ -12,9 +13,9 @@ interface Test {
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Test, test$annotations // TESTED_OBJECTS: Test, getTest$annotations
// ABSENT: TRUE // ABSENT: TRUE
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Test$DefaultImpls, test$annotations // TESTED_OBJECTS: Test$DefaultImpls, getTest$annotations
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC, ACC_DEPRECATED // FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC, ACC_DEPRECATED
@@ -1,4 +1,5 @@
// !JVM_DEFAULT_MODE: enable // !JVM_DEFAULT_MODE: enable
// !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
// JVM_TARGET: 1.8 // JVM_TARGET: 1.8
// WITH_RUNTIME // WITH_RUNTIME
@@ -14,9 +15,9 @@ interface Test {
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Test, test$annotations // TESTED_OBJECTS: Test, getTest$annotations
// ABSENT: TRUE // ABSENT: TRUE
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Test$DefaultImpls, test$annotations // TESTED_OBJECTS: Test$DefaultImpls, getTest$annotations
// FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC, ACC_DEPRECATED // FLAGS: ACC_PUBLIC, ACC_STATIC, ACC_SYNTHETIC, ACC_DEPRECATED
@@ -0,0 +1,12 @@
// !LANGUAGE: -UseGetterNameForPropertyAnnotationsMethodOnJvm
class Foo {
annotation class Anno
@Anno
val prop = 42
}
// TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Foo, prop$annotations
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PUBLIC
@@ -1,3 +1,5 @@
// !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
class Foo { class Foo {
annotation class Anno annotation class Anno
@@ -6,5 +8,5 @@ class Foo {
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Foo, prop$annotations // TESTED_OBJECTS: Foo, getProp$annotations
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PRIVATE // FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PRIVATE
@@ -1,3 +1,5 @@
// !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
open class Foo { open class Foo {
annotation class Anno annotation class Anno
@@ -6,5 +8,5 @@ open class Foo {
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Foo, prop$annotations // TESTED_OBJECTS: Foo, getProp$annotations
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PROTECTED // FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PROTECTED
@@ -1,3 +1,5 @@
// !LANGUAGE: +UseGetterNameForPropertyAnnotationsMethodOnJvm
class Foo { class Foo {
annotation class Anno annotation class Anno
@@ -6,5 +8,5 @@ class Foo {
} }
// TESTED_OBJECT_KIND: function // TESTED_OBJECT_KIND: function
// TESTED_OBJECTS: Foo, prop$annotations // TESTED_OBJECTS: Foo, getProp$annotations
// FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PUBLIC // FLAGS: ACC_DEPRECATED, ACC_STATIC, ACC_SYNTHETIC, ACC_PUBLIC
@@ -1199,6 +1199,11 @@ public class WriteFlagsTestGenerated extends AbstractWriteFlagsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeFlags/property/syntheticAnnotationsMethod"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true); KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeFlags/property/syntheticAnnotationsMethod"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
} }
@TestMetadata("doNotUseGetterName.kt")
public void testDoNotUseGetterName() throws Exception {
runTest("compiler/testData/writeFlags/property/syntheticAnnotationsMethod/doNotUseGetterName.kt");
}
@TestMetadata("privateProperty.kt") @TestMetadata("privateProperty.kt")
public void testPrivateProperty() throws Exception { public void testPrivateProperty() throws Exception {
runTest("compiler/testData/writeFlags/property/syntheticAnnotationsMethod/privateProperty.kt"); runTest("compiler/testData/writeFlags/property/syntheticAnnotationsMethod/privateProperty.kt");
@@ -1199,6 +1199,11 @@ public class IrWriteFlagsTestGenerated extends AbstractIrWriteFlagsTest {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeFlags/property/syntheticAnnotationsMethod"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true); KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/writeFlags/property/syntheticAnnotationsMethod"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
} }
@TestMetadata("doNotUseGetterName.kt")
public void testDoNotUseGetterName() throws Exception {
runTest("compiler/testData/writeFlags/property/syntheticAnnotationsMethod/doNotUseGetterName.kt");
}
@TestMetadata("privateProperty.kt") @TestMetadata("privateProperty.kt")
public void testPrivateProperty() throws Exception { public void testPrivateProperty() throws Exception {
runTest("compiler/testData/writeFlags/property/syntheticAnnotationsMethod/privateProperty.kt"); runTest("compiler/testData/writeFlags/property/syntheticAnnotationsMethod/privateProperty.kt");