KT-2499 If Java class is imported, it is visible in completion three times: as Java class, Kotlin class and package
- Add java trace into delegation for lazy resolve session #KT-2499 Fixed
This commit is contained in:
+1
-1
@@ -139,7 +139,7 @@ public enum AnalyzerFacadeForJVM implements AnalyzerFacade {
|
||||
|
||||
ModuleDescriptor lazyModule = new ModuleDescriptor(Name.special("<lazy module>"));
|
||||
|
||||
return new ResolveSession(fileProject, lazyModule, moduleConfiguration, declarationProviderFactory);
|
||||
return new ResolveSession(fileProject, lazyModule, moduleConfiguration, declarationProviderFactory, javaResolverTrace);
|
||||
}
|
||||
|
||||
public static AnalyzeExhaust analyzeOneFileWithJavaIntegrationAndCheckForErrors(
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.ObservableBindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
@@ -53,7 +54,7 @@ public class ResolveSession {
|
||||
private final ModuleDescriptor module;
|
||||
private final LazyPackageDescriptor rootPackage;
|
||||
|
||||
private final BindingTrace trace = new BindingTraceContext();
|
||||
private final BindingTrace trace;
|
||||
private final DeclarationProviderFactory declarationProviderFactory;
|
||||
|
||||
private final Predicate<FqNameUnsafe> specialClasses;
|
||||
@@ -70,7 +71,25 @@ public class ResolveSession {
|
||||
@NotNull ModuleConfiguration moduleConfiguration,
|
||||
@NotNull DeclarationProviderFactory declarationProviderFactory
|
||||
) {
|
||||
this(project, rootDescriptor, moduleConfiguration, declarationProviderFactory, NO_ALIASES, Predicates.<FqNameUnsafe>alwaysFalse());
|
||||
this(project, rootDescriptor, moduleConfiguration, declarationProviderFactory, NO_ALIASES,
|
||||
Predicates.<FqNameUnsafe>alwaysFalse(),
|
||||
new BindingTraceContext());
|
||||
}
|
||||
|
||||
public ResolveSession(
|
||||
@NotNull Project project,
|
||||
@NotNull ModuleDescriptor rootDescriptor,
|
||||
@NotNull ModuleConfiguration moduleConfiguration,
|
||||
@NotNull DeclarationProviderFactory declarationProviderFactory,
|
||||
@NotNull BindingTrace delegationTrace
|
||||
) {
|
||||
this(project,
|
||||
rootDescriptor,
|
||||
moduleConfiguration,
|
||||
declarationProviderFactory,
|
||||
NO_ALIASES,
|
||||
Predicates.<FqNameUnsafe>alwaysFalse(),
|
||||
delegationTrace);
|
||||
}
|
||||
|
||||
@Deprecated // Internal use only
|
||||
@@ -80,10 +99,12 @@ public class ResolveSession {
|
||||
@NotNull ModuleConfiguration moduleConfiguration,
|
||||
@NotNull DeclarationProviderFactory declarationProviderFactory,
|
||||
@NotNull Function<FqName, Name> classifierAliases,
|
||||
@NotNull Predicate<FqNameUnsafe> specialClasses
|
||||
@NotNull Predicate<FqNameUnsafe> specialClasses,
|
||||
@NotNull BindingTrace delegationTrace
|
||||
) {
|
||||
this.classifierAliases = classifierAliases;
|
||||
this.specialClasses = specialClasses;
|
||||
this.trace = new ObservableBindingTrace(delegationTrace);
|
||||
this.injector = new InjectorForLazyResolve(project, this, trace, moduleConfiguration);
|
||||
this.module = rootDescriptor;
|
||||
this.moduleConfiguration = moduleConfiguration;
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
package org.jetbrains.jet.lang.types.lang;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.collect.*;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -35,6 +38,7 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetImportDirective;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.ImportPath;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.FileBasedDeclarationProviderFactory;
|
||||
@@ -230,7 +234,8 @@ public class KotlinBuiltIns {
|
||||
return ALIASES.get(name);
|
||||
}
|
||||
},
|
||||
Predicates.in(Sets.newHashSet(new FqNameUnsafe("jet.Any"), new FqNameUnsafe("jet.Nothing"))));
|
||||
Predicates.in(Sets.newHashSet(new FqNameUnsafe("jet.Any"), new FqNameUnsafe("jet.Nothing"))),
|
||||
new BindingTraceContext());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+6
-4
@@ -25,23 +25,24 @@ import com.intellij.util.Function;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.ConfigurationKind;
|
||||
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
|
||||
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaToKotlinClassMap;
|
||||
import org.jetbrains.jet.test.util.NamespaceComparator;
|
||||
import org.jetbrains.jet.lang.DefaultModuleConfiguration;
|
||||
import org.jetbrains.jet.lang.ModuleConfiguration;
|
||||
import org.jetbrains.jet.lang.PlatformToKotlinClassMap;
|
||||
import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetImportDirective;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiFactory;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTrace;
|
||||
import org.jetbrains.jet.lang.resolve.BindingTraceContext;
|
||||
import org.jetbrains.jet.lang.resolve.ImportPath;
|
||||
import org.jetbrains.jet.lang.resolve.java.JavaToKotlinClassMap;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
|
||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.resolve.scopes.WritableScope;
|
||||
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns;
|
||||
import org.jetbrains.jet.test.util.NamespaceComparator;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -80,7 +81,8 @@ public class LazyResolveBuiltinClassesTest extends KotlinTestWithEnvironment {
|
||||
return aliases.get(name);
|
||||
}
|
||||
},
|
||||
Predicates.in(Sets.newHashSet(new FqNameUnsafe("jet.Any"), new FqNameUnsafe("jet.Nothing"))));
|
||||
Predicates.in(Sets.newHashSet(new FqNameUnsafe("jet.Any"), new FqNameUnsafe("jet.Nothing"))),
|
||||
new BindingTraceContext());
|
||||
|
||||
NamespaceDescriptor jetNamespaceFromJSL =
|
||||
(NamespaceDescriptor) KotlinBuiltIns.getInstance().getInt().getContainingDeclaration();
|
||||
|
||||
Reference in New Issue
Block a user