[KAPT4] KT-61729 Resolve annotation arguments during generation of @Metadata annotations
This commit is contained in:
committed by
Space Team
parent
798e832943
commit
9d43945b19
+1
-1
@@ -93,7 +93,7 @@ internal class KtFirMetadataCalculator(override val analysisSession: KtFirAnalys
|
||||
for (fir in declarations) {
|
||||
if (fir !is FirFunction && fir !is FirProperty && fir !is FirTypeAlias) continue
|
||||
|
||||
fir.symbol.lazyResolveToPhase(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE)
|
||||
fir.symbol.lazyResolveToPhase(FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING)
|
||||
|
||||
val psiElements = mapping[fir.psi as KtElement]
|
||||
val methods = psiElements.filterIsInstance<PsiMethod>()
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package a;
|
||||
|
||||
/**
|
||||
* public final annotation class a/LinkifyMask : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>()V
|
||||
* public constructor()
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
@b.RestrictTo(value = {b.RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
public abstract @interface LinkifyMask {
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package a;
|
||||
|
||||
/**
|
||||
* public final object a/SphinxLinkify : kotlin/Any {
|
||||
*
|
||||
* // signature: <init>()V
|
||||
* private constructor()
|
||||
*
|
||||
* // signature: addLinks(I)V
|
||||
* private final fun addLinks(mask: kotlin/Int): kotlin/Unit
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public final class SphinxLinkify {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public static final a.SphinxLinkify INSTANCE = null;
|
||||
|
||||
private SphinxLinkify() {
|
||||
super();
|
||||
}
|
||||
|
||||
private final void addLinks(@LinkifyMask()
|
||||
int mask) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package b;
|
||||
|
||||
public @interface RestrictTo {
|
||||
|
||||
Scope[] value();
|
||||
|
||||
public static enum Scope {
|
||||
/*public static final*/ LIBRARY_GROUP_PREFIX /* = new Scope() */;
|
||||
|
||||
private Scope() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
// FULL_JDK
|
||||
|
||||
// FILE: a/LinkifyMask.kt
|
||||
package a
|
||||
|
||||
import b.RestrictTo
|
||||
|
||||
object SphinxLinkify {
|
||||
private fun addLinks(
|
||||
@LinkifyMask mask: Int
|
||||
) {}
|
||||
}
|
||||
|
||||
@RestrictTo(RestrictTo.Scope.LIBRARY_GROUP_PREFIX)
|
||||
annotation class LinkifyMask
|
||||
|
||||
// FILE: b/RestrictTo.java
|
||||
|
||||
package b;
|
||||
|
||||
public @interface RestrictTo {
|
||||
Scope[] value();
|
||||
|
||||
enum Scope {
|
||||
LIBRARY_GROUP_PREFIX,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package a;
|
||||
|
||||
@b.RestrictTo(value = {b.RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
||||
@java.lang.annotation.Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
/**
|
||||
* public final annotation class a/LinkifyMask : kotlin/Annotation {
|
||||
*
|
||||
* // signature: <init>()V
|
||||
* public constructor()
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public abstract @interface LinkifyMask {
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package a;
|
||||
|
||||
/**
|
||||
* public final object a/SphinxLinkify : kotlin/Any {
|
||||
*
|
||||
* // signature: <init>()V
|
||||
* private constructor()
|
||||
*
|
||||
* // signature: addLinks(I)V
|
||||
* private final fun addLinks(mask: kotlin/Int): kotlin/Unit
|
||||
*
|
||||
* // module name: main
|
||||
* }
|
||||
*/
|
||||
@kotlin.Metadata()
|
||||
public final class SphinxLinkify {
|
||||
@org.jetbrains.annotations.NotNull()
|
||||
public static final a.SphinxLinkify INSTANCE = null;
|
||||
|
||||
private SphinxLinkify() {
|
||||
super();
|
||||
}
|
||||
|
||||
private final void addLinks(@LinkifyMask()
|
||||
int mask) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////
|
||||
|
||||
package b;
|
||||
|
||||
public @interface RestrictTo {
|
||||
|
||||
Scope[] value();
|
||||
|
||||
public static enum Scope {
|
||||
/*public static final*/ LIBRARY_GROUP_PREFIX /* = new Scope() */;
|
||||
|
||||
private Scope() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
@@ -487,6 +487,12 @@ public class ClassFileToSourceStubConverterTestGenerated extends AbstractClassFi
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt43786.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt61729.kt")
|
||||
public void testKt61729() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt61729.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lazyProperty.kt")
|
||||
public void testLazyProperty() throws Exception {
|
||||
|
||||
+6
@@ -487,6 +487,12 @@ public class IrClassFileToSourceStubConverterTestGenerated extends AbstractIrCla
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt43786.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt61729.kt")
|
||||
public void testKt61729() throws Exception {
|
||||
runTest("plugins/kapt3/kapt3-compiler/testData/converter/kt61729.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lazyProperty.kt")
|
||||
public void testLazyProperty() throws Exception {
|
||||
|
||||
+6
@@ -487,6 +487,12 @@ public class KotlinKapt4ContextTestGenerated extends AbstractKotlinKapt4ContextT
|
||||
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/kt43786.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt61729.kt")
|
||||
public void testKt61729() throws Exception {
|
||||
runTest("plugins/kapt4/../kapt3/kapt3-compiler/testData/converter/kt61729.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lazyProperty.kt")
|
||||
public void testLazyProperty() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user