[KAPT] KT-64297 Mark deprecated members with @java.lang.Deprecated
Merge-request: KT-MR-13521 Merged-by: Pavel Mikhailovskii <Pavel.Mikhailovskii@jetbrains.com>
This commit is contained in:
committed by
Space Team
parent
34bf32866b
commit
b84aa190d7
@@ -0,0 +1,84 @@
|
||||
package deprecated;
|
||||
|
||||
/**
|
||||
* public final annotation class deprecated/Anno : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>()V
|
||||
* public constructor()
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@kotlin.Deprecated(message = "Deprecated annotation")
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
@java.lang.Deprecated()
|
||||
public abstract @interface Anno {
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package deprecated;
|
||||
|
||||
/**
|
||||
* public final class deprecated/Foo : kotlin/Any {
|
||||
*
|
||||
* // signature: <init>()V
|
||||
* public constructor()
|
||||
*
|
||||
* // signature: foo(I)V
|
||||
* public final fun foo(a: kotlin/Int): kotlin/Unit
|
||||
*
|
||||
* // getter: getFoo()I
|
||||
* // setter: setFoo(I)V
|
||||
* public final var foo: kotlin/Int
|
||||
* public final (* non-default *) get
|
||||
* public final (* non-default *) set(value: kotlin/Int)
|
||||
*
|
||||
* // field: prop:I
|
||||
* // getter: getProp()I
|
||||
* // synthetic method for annotations: getProp$annotations()V
|
||||
* public final val prop: kotlin/Int (* = ... *)
|
||||
* public final get
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@kotlin.Deprecated(message = "Deprecated class")
|
||||
@Anno()
|
||||
@java.lang.Deprecated()
|
||||
public final class Foo {
|
||||
@java.lang.Deprecated()
|
||||
private final int prop = 0;
|
||||
|
||||
public Foo() {
|
||||
super();
|
||||
}
|
||||
|
||||
@kotlin.Deprecated(message = "Deprecated function")
|
||||
@java.lang.Deprecated()
|
||||
public final void foo(int a) {
|
||||
}
|
||||
|
||||
@java.lang.Deprecated()
|
||||
public final int getProp() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@kotlin.Deprecated(message = "Deprecated property")
|
||||
@java.lang.Deprecated()
|
||||
public static void getProp$annotations() {
|
||||
}
|
||||
|
||||
@kotlin.Deprecated(message = "Deprecated getter")
|
||||
@java.lang.Deprecated()
|
||||
public final int getFoo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@kotlin.Deprecated(message = "Deprecated setter")
|
||||
@java.lang.Deprecated()
|
||||
public final void setFoo(int value) {
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
// FIR_BLOCKED: KT-60960
|
||||
package deprecated
|
||||
|
||||
@Deprecated("Deprecated annotation")
|
||||
|
||||
@@ -60,8 +60,10 @@ public final class Test {
|
||||
private final java.lang.Class<?> constJavaClassValue = null;
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
private final kotlin.reflect.KClass<?> constClassValue = null;
|
||||
@java.lang.Deprecated()
|
||||
private boolean isBoolean = false;
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
@java.lang.Deprecated()
|
||||
private kotlin.Unit unit;
|
||||
|
||||
public Test() {
|
||||
@@ -93,6 +95,7 @@ public final class Test {
|
||||
return null;
|
||||
}
|
||||
|
||||
@java.lang.Deprecated()
|
||||
public final boolean isBoolean() {
|
||||
return false;
|
||||
}
|
||||
@@ -102,10 +105,12 @@ public final class Test {
|
||||
public static void isBoolean$annotations() {
|
||||
}
|
||||
|
||||
@java.lang.Deprecated()
|
||||
public final void setBoolean(boolean p0) {
|
||||
}
|
||||
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
@java.lang.Deprecated()
|
||||
public final kotlin.Unit getUnit() {
|
||||
return null;
|
||||
}
|
||||
@@ -115,6 +120,7 @@ public final class Test {
|
||||
public static void getUnit$annotations() {
|
||||
}
|
||||
|
||||
@java.lang.Deprecated()
|
||||
public final void setUnit(@org.jetbrains.annotations.NotNull()
|
||||
kotlin.Unit p0) {
|
||||
}
|
||||
|
||||
@@ -477,8 +477,17 @@ private class StubGenerator(
|
||||
|
||||
private fun Printer.printModifiers(modifierListOwner: PsiModifierListOwner) {
|
||||
val withIndentation = modifierListOwner !is PsiParameter
|
||||
var isDeprecated = (modifierListOwner as? PsiDocCommentOwner)?.isDeprecated == true
|
||||
var hasJavaDeprecated = false
|
||||
for (annotation in modifierListOwner.annotations) {
|
||||
printAnnotation(annotation, withIndentation)
|
||||
isDeprecated = isDeprecated || (annotation.qualifiedName == "kotlin.Deprecated")
|
||||
hasJavaDeprecated = hasJavaDeprecated || (annotation.qualifiedName == "java.lang.Deprecated")
|
||||
}
|
||||
if (isDeprecated && !hasJavaDeprecated) {
|
||||
if (withIndentation)
|
||||
println("@java.lang.Deprecated")
|
||||
else printWithNoIndent("@java.lang.Deprecated ")
|
||||
}
|
||||
|
||||
if (withIndentation) printIndent()
|
||||
|
||||
Reference in New Issue
Block a user