[JVM] Retain deprecated status for interface companion const property.

Create the field directly and maintain the fact that its corresponding
property is the companion object property. That property has the
deprecated annotation which puts the deprecated marker on the field
when code generating the field.

^KT-54840 Fixed
This commit is contained in:
Mads Ager
2022-11-08 13:04:46 +01:00
committed by Alexander Udalov
parent 7b3ce35613
commit 636024f676
6 changed files with 120 additions and 24 deletions
@@ -0,0 +1,13 @@
interface A {
companion object {
@Deprecated("no")
const val s = "yes"
}
}
class B {
companion object {
@Deprecated("no")
const val s = "yes"
}
}
@@ -0,0 +1,38 @@
@kotlin.Metadata
public final class A$Companion {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
synthetic final static field $$INSTANCE: A$Companion
public deprecated final static @org.jetbrains.annotations.NotNull field s: java.lang.String
static method <clinit>(): void
private method <init>(): void
public synthetic deprecated static @kotlin.Deprecated(message="no") method getS$annotations(): void
public final inner class A$Companion
}
@kotlin.Metadata
public interface A {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: A$Companion
public final static @kotlin.Deprecated(message="no") @org.jetbrains.annotations.NotNull field s: java.lang.String
static method <clinit>(): void
public final inner class A$Companion
}
@kotlin.Metadata
public final class B$Companion {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic deprecated static @kotlin.Deprecated(message="no") method getS$annotations(): void
public final inner class B$Companion
}
@kotlin.Metadata
public final class B {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: B$Companion
public deprecated final static @org.jetbrains.annotations.NotNull field s: java.lang.String
static method <clinit>(): void
public method <init>(): void
public final inner class B$Companion
}
@@ -0,0 +1,38 @@
@kotlin.Metadata
public final class A$Companion {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
synthetic final static field $$INSTANCE: A$Companion
public deprecated final static @org.jetbrains.annotations.NotNull field s: java.lang.String
static method <clinit>(): void
private method <init>(): void
public synthetic deprecated static @kotlin.Deprecated(message="no") method getS$annotations(): void
public final inner class A$Companion
}
@kotlin.Metadata
public interface A {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: A$Companion
public deprecated final static @org.jetbrains.annotations.NotNull field s: java.lang.String
static method <clinit>(): void
public final inner class A$Companion
}
@kotlin.Metadata
public final class B$Companion {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
private method <init>(): void
public synthetic method <init>(p0: kotlin.jvm.internal.DefaultConstructorMarker): void
public synthetic deprecated static @kotlin.Deprecated(message="no") method getS$annotations(): void
public final inner class B$Companion
}
@kotlin.Metadata
public final class B {
// source: 'deprecatedConstantPropertyInterfaceCompanion.kt'
public final static @org.jetbrains.annotations.NotNull field Companion: B$Companion
public deprecated final static @org.jetbrains.annotations.NotNull field s: java.lang.String
static method <clinit>(): void
public method <init>(): void
public final inner class B$Companion
}