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:
+3
-9
@@ -231,15 +231,9 @@ public class LazyJavaClassMemberScope(
|
||||
else null
|
||||
}
|
||||
else {
|
||||
// TODO: this caching is a temporary workaround, should be replaced with properly caching the whole LazyJavaPackageFragmentProvider
|
||||
//TODO_R: remove this logic?
|
||||
val alreadyResolved = c.javaResolverCache.getClass(jNestedClass)
|
||||
if (alreadyResolved != null)
|
||||
alreadyResolved
|
||||
else LazyJavaClassDescriptor(c,
|
||||
getContainingDeclaration(),
|
||||
DescriptorUtils.getFqName(getContainingDeclaration()).child(name).toSafe(),
|
||||
jNestedClass)
|
||||
LazyJavaClassDescriptor(
|
||||
c, getContainingDeclaration(), DescriptorUtils.getFqName(getContainingDeclaration()).child(name).toSafe(), jNestedClass
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-10
@@ -114,16 +114,10 @@ public class LazyPackageFragmentScopeForJavaPackage(
|
||||
else if (jClass == null)
|
||||
null
|
||||
else {
|
||||
// TODO: this caching is a temporary workaround, should be replaced with properly caching the whole LazyJavaSubModule
|
||||
val cached = c.javaResolverCache.getClass(jClass)
|
||||
if (cached != null)
|
||||
cached
|
||||
else {
|
||||
val classDescriptor = c.javaClassResolver.resolveClass(jClass)
|
||||
assert(classDescriptor == null || classDescriptor.getContainingDeclaration() == packageFragment,
|
||||
"Wrong package fragment for $classDescriptor, expected $packageFragment")
|
||||
classDescriptor
|
||||
}
|
||||
val classDescriptor = c.javaClassResolver.resolveClass(jClass)
|
||||
assert(classDescriptor == null || classDescriptor.getContainingDeclaration() == packageFragment,
|
||||
"Wrong package fragment for $classDescriptor, expected $packageFragment")
|
||||
classDescriptor
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,12 +75,6 @@ fun LazyJavaResolverContext.lookupBinaryClass(javaClass: JavaClass): ClassDescri
|
||||
}
|
||||
|
||||
fun LazyJavaResolverContext.findClassInJava(fqName: FqName): JavaClassLookupResult {
|
||||
// TODO: this should be governed by module separation logic
|
||||
// Do not look for JavaClasses for Kotlin binaries & built-ins
|
||||
if (DescriptorResolverUtils.getKotlinBuiltinClassDescriptor(fqName) != null) {
|
||||
return JavaClassLookupResult()
|
||||
}
|
||||
|
||||
val kotlinClass = kotlinClassFinder.findKotlinClass(fqName)
|
||||
val binaryClassResult = resolveBinaryClass(kotlinClass)
|
||||
if (binaryClassResult != null) return binaryClassResult
|
||||
|
||||
-18
@@ -287,22 +287,4 @@ public final class DescriptorResolverUtils {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ClassDescriptor getKotlinBuiltinClassDescriptor(@NotNull FqName qualifiedName) {
|
||||
if (!qualifiedName.firstSegmentIs(KotlinBuiltIns.BUILT_INS_PACKAGE_NAME)) return null;
|
||||
|
||||
List<Name> segments = qualifiedName.pathSegments();
|
||||
if (segments.size() < 2) return null;
|
||||
|
||||
JetScope scope = KotlinBuiltIns.getInstance().getBuiltInsPackageScope();
|
||||
for (int i = 1, size = segments.size(); i < size; i++) {
|
||||
ClassifierDescriptor classifier = scope.getClassifier(segments.get(i));
|
||||
if (classifier == null) return null;
|
||||
assert classifier instanceof ClassDescriptor : "Unexpected classifier in built-ins: " + classifier;
|
||||
scope = ((ClassDescriptor) classifier).getUnsubstitutedInnerClassesScope();
|
||||
}
|
||||
|
||||
return (ClassDescriptor) scope.getContainingDeclaration();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -18,7 +18,10 @@ package org.jetbrains.jet.lang.resolve.java.resolver;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.ConstructorDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.PropertyDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
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;
|
||||
@@ -29,9 +32,6 @@ public interface JavaResolverCache {
|
||||
@Nullable
|
||||
ClassDescriptor getClassResolvedFromSource(@NotNull FqName fqName);
|
||||
|
||||
@Nullable
|
||||
ClassDescriptor getClass(@NotNull JavaClass javaClass);
|
||||
|
||||
void recordMethod(@NotNull JavaMethod method, @NotNull SimpleFunctionDescriptor descriptor);
|
||||
|
||||
void recordConstructor(@NotNull JavaElement element, @NotNull ConstructorDescriptor descriptor);
|
||||
|
||||
Reference in New Issue
Block a user