Unused mechanism removed
Incomplete traces are not needed for light classes any more, because light classes use lazy resolve
This commit is contained in:
@@ -47,7 +47,7 @@ public abstract class DeclarationsCacheProvider {
|
||||
new CancelableResolveSessionValueProvider(project, platform), true);
|
||||
}
|
||||
|
||||
public abstract KotlinDeclarationsCache getDeclarations(boolean allowIncomplete);
|
||||
public abstract KotlinDeclarationsCache getDeclarations();
|
||||
|
||||
@NotNull
|
||||
public ResolveSessionForBodies getLazyResolveSession() {
|
||||
|
||||
@@ -71,7 +71,7 @@ class JSDeclarationsCacheProvider extends DeclarationsCacheProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public KotlinDeclarationsCache getDeclarations(boolean allowIncomplete) {
|
||||
public KotlinDeclarationsCache getDeclarations() {
|
||||
synchronized (declarationAnalysisLock) {
|
||||
return CachedValuesManager.getManager(project).getCachedValue(
|
||||
project,
|
||||
|
||||
@@ -81,22 +81,8 @@ class JvmDeclarationsCacheProvider extends DeclarationsCacheProvider {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public KotlinDeclarationsCache getDeclarations(boolean allowIncomplete) {
|
||||
public KotlinDeclarationsCache getDeclarations() {
|
||||
synchronized (declarationAnalysisLock) {
|
||||
if (allowIncomplete) {
|
||||
if (incompleteTrace != null) {
|
||||
// saving context to local variable to avoid race condition
|
||||
final BindingContext context = incompleteTrace.getBindingContext();
|
||||
return new KotlinDeclarationsCache() {
|
||||
@NotNull
|
||||
@Override
|
||||
public BindingContext getBindingContext() {
|
||||
return context;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return CachedValuesManager.getManager(project).getCachedValue(
|
||||
project,
|
||||
cachedKey,
|
||||
|
||||
@@ -49,30 +49,7 @@ public class KotlinCacheManager {
|
||||
public KotlinDeclarationsCache getDeclarationsFromProject(@NotNull TargetPlatform platform) {
|
||||
// Computing declarations should be performed under read lock
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
return getRegisteredProvider(platform).getDeclarations(false);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public KotlinDeclarationsCache getPossiblyIncompleteDeclarationsForLightClassGeneration() {
|
||||
// Computing declarations should be performed under read lock
|
||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||
|
||||
/*
|
||||
* 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 to return partially complete results when we generate light classes
|
||||
*/
|
||||
return getRegisteredProvider(TargetPlatform.JVM).getDeclarations(true);
|
||||
return getRegisteredProvider(platform).getDeclarations();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user