Refactor: remove ResolverScopeData#getFqName()
This commit is contained in:
+1
-8
@@ -41,11 +41,6 @@ public abstract class ResolverScopeData {
|
|||||||
return psiPackage;
|
return psiPackage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
|
||||||
public FqName getFqName() {
|
|
||||||
return fqName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isStaticMembers() {
|
public boolean isStaticMembers() {
|
||||||
return staticMembers;
|
return staticMembers;
|
||||||
}
|
}
|
||||||
@@ -58,8 +53,6 @@ public abstract class ResolverScopeData {
|
|||||||
private final PsiClass psiClass;
|
private final PsiClass psiClass;
|
||||||
@Nullable
|
@Nullable
|
||||||
private final PsiPackage psiPackage;
|
private final PsiPackage psiPackage;
|
||||||
@Nullable
|
|
||||||
private final FqName fqName;
|
|
||||||
private final boolean staticMembers;
|
private final boolean staticMembers;
|
||||||
private final boolean kotlin;
|
private final boolean kotlin;
|
||||||
|
|
||||||
@@ -73,7 +66,6 @@ public abstract class ResolverScopeData {
|
|||||||
|
|
||||||
this.psiClass = psiClass;
|
this.psiClass = psiClass;
|
||||||
this.psiPackage = psiPackage;
|
this.psiPackage = psiPackage;
|
||||||
this.fqName = fqName;
|
|
||||||
|
|
||||||
if (psiClass == null && psiPackage == null) {
|
if (psiClass == null && psiPackage == null) {
|
||||||
throw new IllegalStateException("both psiClass and psiPackage cannot be null");
|
throw new IllegalStateException("both psiClass and psiPackage cannot be null");
|
||||||
@@ -82,6 +74,7 @@ public abstract class ResolverScopeData {
|
|||||||
this.staticMembers = staticMembers;
|
this.staticMembers = staticMembers;
|
||||||
this.kotlin = psiClass != null && DescriptorResolverUtils.isKotlinClass(psiClass);
|
this.kotlin = psiClass != null && DescriptorResolverUtils.isKotlinClass(psiClass);
|
||||||
|
|
||||||
|
//TODO: move check to remove fqName parameter
|
||||||
if (fqName != null && fqName.lastSegmentIs(Name.identifier(JvmAbi.PACKAGE_CLASS)) && psiClass != null && kotlin) {
|
if (fqName != null && fqName.lastSegmentIs(Name.identifier(JvmAbi.PACKAGE_CLASS)) && psiClass != null && kotlin) {
|
||||||
throw new IllegalStateException("Kotlin namespace cannot have last segment " + JvmAbi.PACKAGE_CLASS + ": " + fqName);
|
throw new IllegalStateException("Kotlin namespace cannot have last segment " + JvmAbi.PACKAGE_CLASS + ": " + fqName);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-5
@@ -23,10 +23,8 @@ import com.intellij.psi.PsiClass;
|
|||||||
import com.intellij.psi.PsiPackage;
|
import com.intellij.psi.PsiPackage;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.jet.lang.descriptors.ClassOrNamespaceDescriptor;
|
import org.jetbrains.jet.lang.descriptors.*;
|
||||||
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
|
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.descriptors.VariableDescriptor;
|
|
||||||
import org.jetbrains.jet.lang.resolve.java.JavaSemanticServices;
|
import org.jetbrains.jet.lang.resolve.java.JavaSemanticServices;
|
||||||
import org.jetbrains.jet.lang.resolve.java.NamedMembers;
|
import org.jetbrains.jet.lang.resolve.java.NamedMembers;
|
||||||
import org.jetbrains.jet.lang.resolve.java.data.ResolverScopeData;
|
import org.jetbrains.jet.lang.resolve.java.data.ResolverScopeData;
|
||||||
@@ -142,7 +140,8 @@ public abstract class JavaBaseScope extends JetScopeImpl {
|
|||||||
|
|
||||||
PsiPackage psiPackage = resolverScopeData.getPsiPackage();
|
PsiPackage psiPackage = resolverScopeData.getPsiPackage();
|
||||||
if (psiPackage != null) {
|
if (psiPackage != null) {
|
||||||
result.addAll(computeAllPackageDeclarations(psiPackage, semanticServices, resolverScopeData.getFqName()));
|
assert descriptor instanceof NamespaceDescriptor;
|
||||||
|
result.addAll(computeAllPackageDeclarations(psiPackage, semanticServices, DescriptorUtils.getFQName(descriptor).toSafe()));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user