[FIR] Fix cycle when loading nested enum within java annotation
This commit is contained in:
committed by
Mikhail Glukhikh
parent
947e97511b
commit
7422571c72
+3
@@ -0,0 +1,3 @@
|
|||||||
|
FILE: jvm.kt
|
||||||
|
@R|some/Nls|(R|some/Nls.Capitalization.Title|) public final fun f(): R|kotlin/Unit| {
|
||||||
|
}
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// FILE: some/Nls.java
|
||||||
|
package some
|
||||||
|
public @interface Nls {
|
||||||
|
Capitalization capitalization() default Capitalization.NotSpecified;
|
||||||
|
|
||||||
|
enum Capitalization { NotSpecified, Title, Sentence }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: jvm.kt
|
||||||
|
import some.Nls.Capitalization.*
|
||||||
|
import some.Nls
|
||||||
|
|
||||||
|
@Nls(Title)
|
||||||
|
fun f() {
|
||||||
|
|
||||||
|
}
|
||||||
+6
@@ -5003,6 +5003,12 @@ public class FirDiagnosticTestGenerated extends AbstractFirDiagnosticTest {
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("AnnotationWithEnum.kt")
|
||||||
|
public void testAnnotationWithEnum() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/AnnotationWithEnum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("BasicWithAnnotatedJava.kt")
|
@TestMetadata("BasicWithAnnotatedJava.kt")
|
||||||
public void testBasicWithAnnotatedJava() throws Exception {
|
public void testBasicWithAnnotatedJava() throws Exception {
|
||||||
|
|||||||
+6
@@ -5003,6 +5003,12 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("AnnotationWithEnum.kt")
|
||||||
|
public void testAnnotationWithEnum() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/AnnotationWithEnum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("BasicWithAnnotatedJava.kt")
|
@TestMetadata("BasicWithAnnotatedJava.kt")
|
||||||
public void testBasicWithAnnotatedJava() throws Exception {
|
public void testBasicWithAnnotatedJava() throws Exception {
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ class JavaSymbolProvider(
|
|||||||
|
|
||||||
override fun getClassLikeSymbolByFqName(classId: ClassId): FirRegularClassSymbol? {
|
override fun getClassLikeSymbolByFqName(classId: ClassId): FirRegularClassSymbol? {
|
||||||
return try {
|
return try {
|
||||||
|
if (!hasTopLevelClassOf(classId)) return null
|
||||||
getFirJavaClass(classId)
|
getFirJavaClass(classId)
|
||||||
} catch (e: ProcessCanceledException) {
|
} catch (e: ProcessCanceledException) {
|
||||||
null
|
null
|
||||||
@@ -155,7 +156,9 @@ class JavaSymbolProvider(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getFirJavaClass(classId: ClassId, content: KotlinClassFinder.Result.ClassFileContent? = null): FirRegularClassSymbol? {
|
fun getFirJavaClass(classId: ClassId, content: KotlinClassFinder.Result.ClassFileContent? = null): FirRegularClassSymbol? {
|
||||||
if (!hasTopLevelClassOf(classId)) return null
|
// Enforce loading of outer class first
|
||||||
|
classId.outerClassId?.let { getFirJavaClass(it) }
|
||||||
|
|
||||||
return classCache.getValue(classId, content)
|
return classCache.getValue(classId, content)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
@@ -5003,6 +5003,12 @@ public class DiagnosisCompilerFirTestdataTestGenerated extends AbstractDiagnosis
|
|||||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k"), Pattern.compile("^([^.]+)\\.kt$"), null, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("AnnotationWithEnum.kt")
|
||||||
|
public void testAnnotationWithEnum() throws Exception {
|
||||||
|
runTest("compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/AnnotationWithEnum.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("BasicWithAnnotatedJava.kt")
|
@TestMetadata("BasicWithAnnotatedJava.kt")
|
||||||
public void testBasicWithAnnotatedJava() throws Exception {
|
public void testBasicWithAnnotatedJava() throws Exception {
|
||||||
|
|||||||
Reference in New Issue
Block a user