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);
|
new CancelableResolveSessionValueProvider(project, platform), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract KotlinDeclarationsCache getDeclarations(boolean allowIncomplete);
|
public abstract KotlinDeclarationsCache getDeclarations();
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
public ResolveSessionForBodies getLazyResolveSession() {
|
public ResolveSessionForBodies getLazyResolveSession() {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ class JSDeclarationsCacheProvider extends DeclarationsCacheProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KotlinDeclarationsCache getDeclarations(boolean allowIncomplete) {
|
public KotlinDeclarationsCache getDeclarations() {
|
||||||
synchronized (declarationAnalysisLock) {
|
synchronized (declarationAnalysisLock) {
|
||||||
return CachedValuesManager.getManager(project).getCachedValue(
|
return CachedValuesManager.getManager(project).getCachedValue(
|
||||||
project,
|
project,
|
||||||
|
|||||||
@@ -81,22 +81,8 @@ class JvmDeclarationsCacheProvider extends DeclarationsCacheProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@NotNull
|
@NotNull
|
||||||
public KotlinDeclarationsCache getDeclarations(boolean allowIncomplete) {
|
public KotlinDeclarationsCache getDeclarations() {
|
||||||
synchronized (declarationAnalysisLock) {
|
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(
|
return CachedValuesManager.getManager(project).getCachedValue(
|
||||||
project,
|
project,
|
||||||
cachedKey,
|
cachedKey,
|
||||||
|
|||||||
@@ -49,30 +49,7 @@ public class KotlinCacheManager {
|
|||||||
public KotlinDeclarationsCache getDeclarationsFromProject(@NotNull TargetPlatform platform) {
|
public KotlinDeclarationsCache getDeclarationsFromProject(@NotNull TargetPlatform platform) {
|
||||||
// Computing declarations should be performed under read lock
|
// Computing declarations should be performed under read lock
|
||||||
ApplicationManager.getApplication().assertReadAccessAllowed();
|
ApplicationManager.getApplication().assertReadAccessAllowed();
|
||||||
return getRegisteredProvider(platform).getDeclarations(false);
|
return getRegisteredProvider(platform).getDeclarations();
|
||||||
}
|
|
||||||
|
|
||||||
@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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
Reference in New Issue
Block a user