JDR: drop various code that is marked as temporary

Remove additional logic for comparing files in JavaClassFinderImpl
Drop redundant check for builtins in findClassInJava(FqName)
Drop resolve cache query in LazyJavaClassMemberScope and LazyJavaPackageFragmentScope
This commit is contained in:
Pavel V. Talanov
2014-08-18 15:54:38 +04:00
parent e56a124c0b
commit 46f1873dc8
8 changed files with 11 additions and 87 deletions
@@ -17,7 +17,6 @@
package org.jetbrains.jet.lang.resolve.java;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiPackage;
@@ -62,24 +61,6 @@ public class JavaClassFinderImpl implements JavaClassFinder {
return myBaseScope.contains(file) && file.getFileType() != JetFileType.INSTANCE;
}
@Override
public int compare(VirtualFile file1, VirtualFile file2) {
//TODO_r: delete this code?
// TODO: this is a hackish workaround for the following problem:
// since we are working with the allScope(), if the same class FqName
// to be on the class path twice, because it is included into different libraries
// (e.g. junit-4.0.jar is used as a separate library and as a part of idea_full)
// the two libraries are attached to different modules, the parent compare()
// can't tell which one comes first, so they can come in random order
// To fix this, we sort additionally by the full path, to make the ordering deterministic
// TODO: Delete this hack when proper scopes are used
int compare = super.compare(file1, file2);
if (compare == 0) {
return Comparing.compare(file1.getPath(), file2.getPath());
}
return compare;
}
//NOTE: expected by class finder to be not null
@NotNull
@Override
@@ -24,16 +24,9 @@ import org.jetbrains.jet.lang.resolve.java.structure.JavaMethod
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession
import org.jetbrains.jet.lang.resolve.lazy.ResolveSessionUtils
import org.jetbrains.jet.lang.resolve.name.FqName
import org.jetbrains.jet.lang.types.TypeProjection
import javax.inject.Inject
import java.util.Collections
import kotlin.properties.Delegates
import org.jetbrains.jet.lang.types.lang.KotlinBuiltIns
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.Logger
import org.jetbrains.jet.lang.resolve.java.structure.impl.JavaClassImpl
import com.google.common.base.Predicates
import org.jetbrains.jet.lang.descriptors.impl.PackageViewDescriptorImpl
import org.jetbrains.jet.lang.resolve.name.tail
import org.jetbrains.jet.lang.resolve.name.each
@@ -62,10 +55,6 @@ public class LazyResolveBasedCache() : JavaResolverCache {
}
}
override fun getClass(javaClass: JavaClass): ClassDescriptor? {
return traceBasedCache.getClass(javaClass) ?: null
}
override fun recordMethod(method: JavaMethod, descriptor: SimpleFunctionDescriptor) {
traceBasedCache.recordMethod(method, descriptor)
}
@@ -16,9 +16,7 @@
package org.jetbrains.jet.lang.resolve.java.resolver;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiField;
import com.intellij.psi.impl.JavaConstantExpressionEvaluator;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
@@ -27,8 +25,6 @@ import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
import org.jetbrains.jet.lang.resolve.BindingContextUtils;
import org.jetbrains.jet.lang.resolve.BindingTrace;
import org.jetbrains.jet.lang.resolve.CompileTimeConstantUtils;
import org.jetbrains.jet.lang.resolve.constants.CompileTimeConstant;
import org.jetbrains.jet.lang.resolve.java.structure.JavaClass;
import org.jetbrains.jet.lang.resolve.java.structure.JavaElement;
import org.jetbrains.jet.lang.resolve.java.structure.JavaField;
@@ -57,12 +53,6 @@ public class TraceBasedJavaResolverCache implements JavaResolverCache {
return trace.get(FQNAME_TO_CLASS_DESCRIPTOR, fqName.toUnsafe());
}
@Nullable
@Override
public ClassDescriptor getClass(@NotNull JavaClass javaClass) {
return trace.get(CLASS, ((JavaClassImpl) javaClass).getPsi());
}
@Override
public void recordMethod(@NotNull JavaMethod method, @NotNull SimpleFunctionDescriptor descriptor) {
BindingContextUtils.recordFunctionDeclarationToDescriptor(trace, ((JavaMethodImpl) method).getPsi(), descriptor);