Some comments to clarify what's going on
This commit is contained in:
+4
@@ -77,11 +77,13 @@ public class JavaDescriptorResolver {
|
||||
public ClassDescriptor resolveClass(@NotNull PsiClass psiClass) {
|
||||
String qualifiedName = psiClass.getQualifiedName();
|
||||
|
||||
// First, let's check that this is a real Java class, not a Java's view on a Kotlin class:
|
||||
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(qualifiedName);
|
||||
if (kotlinClassDescriptor != null) {
|
||||
return kotlinClassDescriptor;
|
||||
}
|
||||
|
||||
// Not let's take a descriptor of a Java class
|
||||
ClassDescriptor classDescriptor = classDescriptorCache.get(qualifiedName);
|
||||
if (classDescriptor == null) {
|
||||
classDescriptor = createJavaClassDescriptor(psiClass);
|
||||
@@ -92,11 +94,13 @@ public class JavaDescriptorResolver {
|
||||
|
||||
@Nullable
|
||||
public ClassDescriptor resolveClass(@NotNull String qualifiedName) {
|
||||
// First, let's check that this is a real Java class, not a Java's view on a Kotlin class:
|
||||
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(qualifiedName);
|
||||
if (kotlinClassDescriptor != null) {
|
||||
return kotlinClassDescriptor;
|
||||
}
|
||||
|
||||
// Not let's take a descriptor of a Java class
|
||||
ClassDescriptor classDescriptor = classDescriptorCache.get(qualifiedName);
|
||||
if (classDescriptor == null) {
|
||||
PsiClass psiClass = findClass(qualifiedName);
|
||||
|
||||
@@ -41,6 +41,8 @@ public class JavaPackageScope extends JetScopeImpl {
|
||||
@NotNull
|
||||
@Override
|
||||
public Set<FunctionDescriptor> getFunctions(@NotNull String name) {
|
||||
// If this package is actually a Kotlin namespace, then we access it through a namespace descriptor, and
|
||||
// Kotlin functions are already there
|
||||
NamespaceDescriptor kotlinNamespaceDescriptor = semanticServices.getKotlinNamespaceDescriptor(packageFQN);
|
||||
if (kotlinNamespaceDescriptor != null) {
|
||||
return Collections.emptySet();
|
||||
@@ -83,6 +85,7 @@ public class JavaPackageScope extends JetScopeImpl {
|
||||
}
|
||||
|
||||
for (PsiClass psiClass : javaPackage.getClasses()) {
|
||||
// If this is a Kotlin class, we have already taken it through a containing namespace descriptor
|
||||
ClassDescriptor kotlinClassDescriptor = semanticServices.getKotlinClassDescriptor(psiClass.getQualifiedName());
|
||||
if (kotlinClassDescriptor != null) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user