Incomplete analysis results are available for light class generation
If we have the following classes
class A // Kotlin
class B extends A {} // Java
class C : B() // Kotlin
The analysis runs into infinite recursion, because C needs all members of B (to compute overrides),
and B needs all members of A, and A is not available from KotlinCacheManager.getDeclarationsFromProject() -- it is being computed right now,
so the analysis runs again...
Our workaround is:
* when analysis starts put its trace into user data on the project
* when a light class is about to generate a stub, it requests a trace, and if there is such an incomplete trace, it is returned
* the logic of TopDownAnalyzer that works in descending order (down the class hierarchy) guarantees that all the superclasses are already processed
This commit is contained in:
@@ -0,0 +1 @@
|
||||
public open class A<caret>
|
||||
@@ -0,0 +1,3 @@
|
||||
public class MyClass<caret> extends A {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
public class B: MyClass()
|
||||
@@ -0,0 +1,7 @@
|
||||
<node text="Object (java.lang)">
|
||||
<node text="A ()" base="true">
|
||||
<node text="MyClass ()">
|
||||
<node text="B ()"/>
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
Reference in New Issue
Block a user