FIR Java: unbind possible named annotation cycle
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
// FILE: AliasFor.java
|
||||
|
||||
public @interface AliasFor {
|
||||
@AliasFor(value = "attribute")
|
||||
String value() default "";
|
||||
|
||||
@AliasFor(value = "value")
|
||||
String attribute() default "";
|
||||
}
|
||||
|
||||
// FILE: Service.java
|
||||
public @interface Service {
|
||||
@AliasFor(value = "component")
|
||||
String value() default "";
|
||||
}
|
||||
|
||||
// FILE: Annotated.kt
|
||||
|
||||
@Service(value = "Your")
|
||||
class My
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: Annotated.kt
|
||||
@R|Service|(value = String(Your)) public final class My : R|kotlin/Any| {
|
||||
public constructor(): R|My| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
Generated
+5
@@ -2079,6 +2079,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveNamedAnnotation.kt")
|
||||
public void testRecursiveNamedAnnotation() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallInvoke.kt")
|
||||
public void testSafeCallInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
||||
|
||||
+5
@@ -2079,6 +2079,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveNamedAnnotation.kt")
|
||||
public void testRecursiveNamedAnnotation() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallInvoke.kt")
|
||||
public void testSafeCallInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
||||
|
||||
+5
@@ -2079,6 +2079,11 @@ public class LazyBodyIsNotTouchedTilContractsPhaseTestGenerated extends Abstract
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/questionableSmartCast.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("recursiveNamedAnnotation.kt")
|
||||
public void testRecursiveNamedAnnotation() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/recursiveNamedAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("safeCallInvoke.kt")
|
||||
public void testSafeCallInvoke() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
||||
|
||||
@@ -168,6 +168,7 @@ class JavaSymbolProvider(
|
||||
javaTypeParameterStack.addStack(parentStack)
|
||||
}
|
||||
}
|
||||
val methodMap = mutableMapOf<JavaMethod, FirJavaMethod>()
|
||||
val firJavaClass = buildJavaClass {
|
||||
source = (javaClass as? JavaElementImpl<*>)?.psi?.toFirPsiSourceElement()
|
||||
session = this@JavaSymbolProvider.session
|
||||
@@ -219,7 +220,9 @@ class JavaSymbolProvider(
|
||||
classIsAnnotation,
|
||||
valueParametersForAnnotationConstructor,
|
||||
dispatchReceiver
|
||||
)
|
||||
).apply {
|
||||
methodMap[javaMethod] = this
|
||||
}
|
||||
}
|
||||
val javaClassDeclaredConstructors = javaClass.constructors
|
||||
val constructorId = CallableId(classId.packageFqName, classId.relativeClassName, classId.shortClassName)
|
||||
@@ -270,6 +273,10 @@ class JavaSymbolProvider(
|
||||
}
|
||||
)
|
||||
firJavaClass.addAnnotationsFrom(this@JavaSymbolProvider.session, javaClass, javaTypeParameterStack)
|
||||
// NB: this is done here to unbind possible annotation cycle
|
||||
for ((javaMethod, firJavaMethod) in methodMap) {
|
||||
firJavaMethod.annotations.addAnnotationsFrom(session, javaMethod, javaTypeParameterStack)
|
||||
}
|
||||
return firJavaClass
|
||||
}
|
||||
|
||||
@@ -364,7 +371,6 @@ class JavaSymbolProvider(
|
||||
returnTypeRef = returnType.toFirJavaTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack)
|
||||
isStatic = javaMethod.isStatic
|
||||
typeParameters += javaMethod.typeParameters.convertTypeParameters(javaTypeParameterStack)
|
||||
addAnnotationsFrom(this@JavaSymbolProvider.session, javaMethod, javaTypeParameterStack)
|
||||
for ((index, valueParameter) in javaMethod.valueParameters.withIndex()) {
|
||||
valueParameters += valueParameter.toFirValueParameter(
|
||||
this@JavaSymbolProvider.session, index, javaTypeParameterStack,
|
||||
|
||||
@@ -485,7 +485,7 @@ internal fun FirJavaClass.addAnnotationsFrom(
|
||||
annotations.addAnnotationsFrom(session, javaAnnotationOwner, javaTypeParameterStack)
|
||||
}
|
||||
|
||||
private fun MutableList<FirAnnotationCall>.addAnnotationsFrom(
|
||||
internal fun MutableList<FirAnnotationCall>.addAnnotationsFrom(
|
||||
session: FirSession,
|
||||
javaAnnotationOwner: JavaAnnotationOwner,
|
||||
javaTypeParameterStack: JavaTypeParameterStack
|
||||
|
||||
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java
Generated
-5
@@ -5461,11 +5461,6 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
|
||||
public void testAllFilesPresentInBigArity() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/functions/bigArity"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("nestedBigArityFunCalls.kt")
|
||||
public void testNestedBigArityFunCalls() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/functions/bigArity/nestedBigArityFunCalls.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/functions/functionExpression")
|
||||
|
||||
Reference in New Issue
Block a user