提交 459c2e91 编写于 作者: A Andrey Breslav

Some comments to clarify what's going on

上级 370167ee
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册