Return proper fqname for package classes
This commit is contained in:
+4
-9
@@ -22,7 +22,6 @@ import com.intellij.navigation.ItemPresentationProviders;
|
|||||||
import com.intellij.openapi.util.Comparing;
|
import com.intellij.openapi.util.Comparing;
|
||||||
import com.intellij.psi.PsiClass;
|
import com.intellij.psi.PsiClass;
|
||||||
import com.intellij.psi.PsiElement;
|
import com.intellij.psi.PsiElement;
|
||||||
import com.intellij.psi.PsiFile;
|
|
||||||
import com.intellij.psi.PsiManager;
|
import com.intellij.psi.PsiManager;
|
||||||
import com.intellij.psi.impl.java.stubs.PsiJavaFileStub;
|
import com.intellij.psi.impl.java.stubs.PsiJavaFileStub;
|
||||||
import com.intellij.psi.util.CachedValue;
|
import com.intellij.psi.util.CachedValue;
|
||||||
@@ -48,6 +47,7 @@ public class KotlinLightClassForPackage extends KotlinLightClassForPackageBase i
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final FqName packageFqName;
|
private final FqName packageFqName;
|
||||||
|
private final FqName packageClassFqName; // derived from packageFqName
|
||||||
private final Collection<JetFile> files;
|
private final Collection<JetFile> files;
|
||||||
private final int hashCode;
|
private final int hashCode;
|
||||||
private final CachedValue<PsiJavaFileStub> javaFileStub;
|
private final CachedValue<PsiJavaFileStub> javaFileStub;
|
||||||
@@ -55,6 +55,7 @@ public class KotlinLightClassForPackage extends KotlinLightClassForPackageBase i
|
|||||||
private KotlinLightClassForPackage(@NotNull PsiManager manager, @NotNull FqName packageFqName, @NotNull Collection<JetFile> files) {
|
private KotlinLightClassForPackage(@NotNull PsiManager manager, @NotNull FqName packageFqName, @NotNull Collection<JetFile> files) {
|
||||||
super(manager);
|
super(manager);
|
||||||
this.packageFqName = packageFqName;
|
this.packageFqName = packageFqName;
|
||||||
|
this.packageClassFqName = packageFqName.child(Name.identifier(JvmAbi.PACKAGE_CLASS));
|
||||||
assert !files.isEmpty() : "No files for package " + packageFqName;
|
assert !files.isEmpty() : "No files for package " + packageFqName;
|
||||||
this.files = Sets.newHashSet(files); // needed for hashCode
|
this.files = Sets.newHashSet(files); // needed for hashCode
|
||||||
this.hashCode = computeHashCode();
|
this.hashCode = computeHashCode();
|
||||||
@@ -65,13 +66,13 @@ public class KotlinLightClassForPackage extends KotlinLightClassForPackageBase i
|
|||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return packageFqName.shortName().getName();
|
return packageClassFqName.shortName().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public String getQualifiedName() {
|
public String getQualifiedName() {
|
||||||
return packageFqName.getFqName();
|
return packageClassFqName.getFqName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -95,7 +96,6 @@ public class KotlinLightClassForPackage extends KotlinLightClassForPackageBase i
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public PsiClass getDelegate() {
|
public PsiClass getDelegate() {
|
||||||
FqName packageClassFqName = packageFqName.child(Name.identifier(JvmAbi.PACKAGE_CLASS));
|
|
||||||
PsiClass psiClass = LightClassUtil.findClass(packageClassFqName, javaFileStub.getValue());
|
PsiClass psiClass = LightClassUtil.findClass(packageClassFqName, javaFileStub.getValue());
|
||||||
if (psiClass == null) {
|
if (psiClass == null) {
|
||||||
throw new IllegalStateException("Package class was not found " + packageFqName);
|
throw new IllegalStateException("Package class was not found " + packageFqName);
|
||||||
@@ -124,11 +124,6 @@ public class KotlinLightClassForPackage extends KotlinLightClassForPackageBase i
|
|||||||
throw new UnsupportedOperationException("This should be done byt JetIconProvider");
|
throw new UnsupportedOperationException("This should be done byt JetIconProvider");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public PsiFile getContainingFile() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return hashCode;
|
return hashCode;
|
||||||
|
|||||||
Reference in New Issue
Block a user