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");
|
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")
|
@TestMetadata("safeCallInvoke.kt")
|
||||||
public void testSafeCallInvoke() throws Exception {
|
public void testSafeCallInvoke() throws Exception {
|
||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
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");
|
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")
|
@TestMetadata("safeCallInvoke.kt")
|
||||||
public void testSafeCallInvoke() throws Exception {
|
public void testSafeCallInvoke() throws Exception {
|
||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
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");
|
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")
|
@TestMetadata("safeCallInvoke.kt")
|
||||||
public void testSafeCallInvoke() throws Exception {
|
public void testSafeCallInvoke() throws Exception {
|
||||||
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
runTest("compiler/fir/analysis-tests/testData/resolve/problems/safeCallInvoke.kt");
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ class JavaSymbolProvider(
|
|||||||
javaTypeParameterStack.addStack(parentStack)
|
javaTypeParameterStack.addStack(parentStack)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
val methodMap = mutableMapOf<JavaMethod, FirJavaMethod>()
|
||||||
val firJavaClass = buildJavaClass {
|
val firJavaClass = buildJavaClass {
|
||||||
source = (javaClass as? JavaElementImpl<*>)?.psi?.toFirPsiSourceElement()
|
source = (javaClass as? JavaElementImpl<*>)?.psi?.toFirPsiSourceElement()
|
||||||
session = this@JavaSymbolProvider.session
|
session = this@JavaSymbolProvider.session
|
||||||
@@ -219,7 +220,9 @@ class JavaSymbolProvider(
|
|||||||
classIsAnnotation,
|
classIsAnnotation,
|
||||||
valueParametersForAnnotationConstructor,
|
valueParametersForAnnotationConstructor,
|
||||||
dispatchReceiver
|
dispatchReceiver
|
||||||
)
|
).apply {
|
||||||
|
methodMap[javaMethod] = this
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val javaClassDeclaredConstructors = javaClass.constructors
|
val javaClassDeclaredConstructors = javaClass.constructors
|
||||||
val constructorId = CallableId(classId.packageFqName, classId.relativeClassName, classId.shortClassName)
|
val constructorId = CallableId(classId.packageFqName, classId.relativeClassName, classId.shortClassName)
|
||||||
@@ -270,6 +273,10 @@ class JavaSymbolProvider(
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
firJavaClass.addAnnotationsFrom(this@JavaSymbolProvider.session, javaClass, javaTypeParameterStack)
|
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
|
return firJavaClass
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +371,6 @@ class JavaSymbolProvider(
|
|||||||
returnTypeRef = returnType.toFirJavaTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack)
|
returnTypeRef = returnType.toFirJavaTypeRef(this@JavaSymbolProvider.session, javaTypeParameterStack)
|
||||||
isStatic = javaMethod.isStatic
|
isStatic = javaMethod.isStatic
|
||||||
typeParameters += javaMethod.typeParameters.convertTypeParameters(javaTypeParameterStack)
|
typeParameters += javaMethod.typeParameters.convertTypeParameters(javaTypeParameterStack)
|
||||||
addAnnotationsFrom(this@JavaSymbolProvider.session, javaMethod, javaTypeParameterStack)
|
|
||||||
for ((index, valueParameter) in javaMethod.valueParameters.withIndex()) {
|
for ((index, valueParameter) in javaMethod.valueParameters.withIndex()) {
|
||||||
valueParameters += valueParameter.toFirValueParameter(
|
valueParameters += valueParameter.toFirValueParameter(
|
||||||
this@JavaSymbolProvider.session, index, javaTypeParameterStack,
|
this@JavaSymbolProvider.session, index, javaTypeParameterStack,
|
||||||
|
|||||||
@@ -485,7 +485,7 @@ internal fun FirJavaClass.addAnnotationsFrom(
|
|||||||
annotations.addAnnotationsFrom(session, javaAnnotationOwner, javaTypeParameterStack)
|
annotations.addAnnotationsFrom(session, javaAnnotationOwner, javaTypeParameterStack)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MutableList<FirAnnotationCall>.addAnnotationsFrom(
|
internal fun MutableList<FirAnnotationCall>.addAnnotationsFrom(
|
||||||
session: FirSession,
|
session: FirSession,
|
||||||
javaAnnotationOwner: JavaAnnotationOwner,
|
javaAnnotationOwner: JavaAnnotationOwner,
|
||||||
javaTypeParameterStack: JavaTypeParameterStack
|
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 {
|
public void testAllFilesPresentInBigArity() throws Exception {
|
||||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/functions/bigArity"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
|
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")
|
@TestMetadata("compiler/testData/codegen/box/functions/functionExpression")
|
||||||
|
|||||||
Reference in New Issue
Block a user