DescriptorSearchRule removed
This commit is contained in:
committed by
Alexander Udalov
parent
aa0dde3a78
commit
8dc9aecbf8
-33
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.jetbrains.jet.lang.resolve.java;
|
||||
|
||||
/*
|
||||
* This class indicates whether we should look into kotlin sources when searching for descriptors in JavaDescriptorResolver.
|
||||
* This is a hack because it should be done via correct scopes.
|
||||
* Order in which we attempt to resolve descriptors is also should be taken care of. (though it is correct for the most part now)
|
||||
* */
|
||||
public enum DescriptorSearchRule {
|
||||
//Return immediately if you found descriptor in kotlin sources, if not continue
|
||||
INCLUDE_KOTLIN_SOURCES,
|
||||
//Do not try to find descriptors in kotlin sources.
|
||||
//This flag is mostly used when resolving descriptors from binaries or java descriptors.
|
||||
//It will not prevent from looking into java sources which is often desirable behaviour.
|
||||
//It is not correct because sometimes class from sources can override class from binary since it comes earlier in classpath
|
||||
//and for a thousand more reasons.
|
||||
IGNORE_KOTLIN_SOURCES
|
||||
}
|
||||
+1
-9
@@ -33,10 +33,6 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
import org.jetbrains.jet.lang.types.DependencyClassByQualifiedNameResolver;
|
||||
import org.jetbrains.jet.storage.StorageManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule.IGNORE_KOTLIN_SOURCES;
|
||||
|
||||
public class JavaDescriptorResolver implements DependencyClassByQualifiedNameResolver {
|
||||
public static final Name JAVA_ROOT = Name.special("<java_root>");
|
||||
|
||||
@@ -100,13 +96,9 @@ public class JavaDescriptorResolver implements DependencyClassByQualifiedNameRes
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ClassDescriptor resolveClass(@NotNull FqName qualifiedName, @NotNull DescriptorSearchRule searchRule) {
|
||||
return getPackageFragmentProvider().getClass(qualifiedName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassDescriptor resolveClass(@NotNull FqName qualifiedName) {
|
||||
return resolveClass(qualifiedName, IGNORE_KOTLIN_SOURCES);
|
||||
return getPackageFragmentProvider().getClass(qualifiedName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-3
@@ -52,7 +52,6 @@ import java.util.*;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isClassObject;
|
||||
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isTrait;
|
||||
import static org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule.IGNORE_KOTLIN_SOURCES;
|
||||
import static org.jetbrains.jet.lang.resolve.kotlin.DeserializedResolverUtils.kotlinFqNameToJavaFqName;
|
||||
import static org.jetbrains.jet.lang.resolve.kotlin.DeserializedResolverUtils.naiveKotlinFqName;
|
||||
|
||||
@@ -216,8 +215,7 @@ public class AnnotationDescriptorDeserializer implements AnnotationDeserializer
|
||||
|
||||
@NotNull
|
||||
private ClassDescriptor resolveClass(@NotNull JvmClassName className) {
|
||||
ClassDescriptor annotationClass = javaDescriptorResolver.resolveClass(className.getFqNameForClassNameWithoutDollars(),
|
||||
IGNORE_KOTLIN_SOURCES);
|
||||
ClassDescriptor annotationClass = javaDescriptorResolver.resolveClass(className.getFqNameForClassNameWithoutDollars());
|
||||
return annotationClass != null ? annotationClass : ErrorUtils.getErrorClass();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -38,7 +38,6 @@ import org.jetbrains.jet.storage.StorageManager;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.jetbrains.jet.lang.resolve.java.DescriptorSearchRule.INCLUDE_KOTLIN_SOURCES;
|
||||
import static org.jetbrains.jet.lang.resolve.kotlin.DeserializedResolverUtils.kotlinFqNameToJavaFqName;
|
||||
import static org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader.Kind.CLASS;
|
||||
import static org.jetbrains.jet.lang.resolve.kotlin.header.KotlinClassHeader.Kind.PACKAGE_FACADE;
|
||||
@@ -59,7 +58,7 @@ public final class DeserializedDescriptorResolver {
|
||||
@Nullable
|
||||
@Override
|
||||
public ClassDescriptor findClass(@NotNull ClassId classId) {
|
||||
return javaDescriptorResolver.resolveClass(kotlinFqNameToJavaFqName(classId.asSingleFqName()), INCLUDE_KOTLIN_SOURCES);
|
||||
return javaDescriptorResolver.resolveClass(kotlinFqNameToJavaFqName(classId.asSingleFqName()));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user