[AA-FIR] Fix handling of Java annotation parameters.

This changes FirAnnotationValueConverter to no longer rely on PSI
information when projecting annotation parameter information to AA.
For annotations defined in Java, including many meta-annotations, PSI
information is not available for the annotation. This caused those
annotation values to be projected as KtUnsupportedAnnotationValue.

Instead of using PSI information, this changes
FirAnnotationValueConverter to use the tree structure instead. Spread
and named parameter arguments are spliced into the parameter list of
their surrounding vararg calls, meaning that callers see the expected
structure. (See the varargSpreadParameter.kt test file for an example.)
This commit is contained in:
Justin Paupore
2022-12-08 14:42:11 -08:00
committed by Yan Zhulanow
parent fbcde11b04
commit 212baf580c
19 changed files with 169 additions and 32 deletions
@@ -67,6 +67,12 @@ public class Fe10IdeNormalAnalysisSourceModuleAnalysisApiAnnotationsOnDeclaratio
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("emptyJavaSpreadParameter.kt")
public void testEmptyJavaSpreadParameter() throws Exception {
runTest("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/emptyJavaSpreadParameter.kt");
}
@Test
@TestMetadata("onClass.kt")
public void testOnClass() throws Exception {
@@ -103,11 +109,29 @@ public class Fe10IdeNormalAnalysisSourceModuleAnalysisApiAnnotationsOnDeclaratio
runTest("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/onTypeAlias.kt");
}
@Test
@TestMetadata("varargComplexParameter.kt")
public void testVarargComplexParameter() throws Exception {
runTest("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/varargComplexParameter.kt");
}
@Test
@TestMetadata("varargNamedParameter.kt")
public void testVarargNamedParameter() throws Exception {
runTest("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/varargNamedParameter.kt");
}
@Test
@TestMetadata("varargParameter.kt")
public void testVarargParameter() throws Exception {
runTest("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/varargParameter.kt");
}
@Test
@TestMetadata("varargSpreadParameter.kt")
public void testVarargSpreadParameter() throws Exception {
runTest("analysis/analysis-api/testData/annotations/annotationsOnDeclaration/direct/varargSpreadParameter.kt");
}
}
@Nested
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/