Refactor: remove useless check in PsiDeclarationProviderFactory
This commit is contained in:
+2
-11
@@ -19,10 +19,6 @@ package org.jetbrains.jet.lang.resolve.java.provider;
|
|||||||
import com.intellij.psi.PsiClass;
|
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.jet.lang.resolve.java.JvmAbi;
|
|
||||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
|
||||||
import org.jetbrains.jet.lang.resolve.name.Name;
|
|
||||||
|
|
||||||
public final class PsiDeclarationProviderFactory {
|
public final class PsiDeclarationProviderFactory {
|
||||||
private PsiDeclarationProviderFactory() {
|
private PsiDeclarationProviderFactory() {
|
||||||
@@ -41,14 +37,9 @@ public final class PsiDeclarationProviderFactory {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public static KotlinNamespacePsiDeclarationProvider createDeclarationForKotlinNamespace(
|
public static KotlinNamespacePsiDeclarationProvider createDeclarationForKotlinNamespace(
|
||||||
@NotNull PsiPackage psiPackage,
|
@NotNull PsiPackage psiPackage,
|
||||||
@NotNull PsiClass psiClass,
|
@NotNull PsiClass psiClass
|
||||||
@Nullable FqName fqName
|
|
||||||
) {
|
) {
|
||||||
KotlinNamespacePsiDeclarationProvider result = new KotlinNamespacePsiDeclarationProvider(psiPackage, psiClass);
|
return new KotlinNamespacePsiDeclarationProvider(psiPackage, psiClass);
|
||||||
if (fqName != null && fqName.lastSegmentIs(Name.identifier(JvmAbi.PACKAGE_CLASS))) {
|
|
||||||
throw new IllegalStateException("Kotlin namespace cannot have last segment " + JvmAbi.PACKAGE_CLASS + ": " + fqName);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
|
|||||||
+1
-1
@@ -155,7 +155,7 @@ public final class JavaNamespaceResolver {
|
|||||||
fqName, javaSemanticServices);
|
fqName, javaSemanticServices);
|
||||||
}
|
}
|
||||||
return new JavaScopeForKotlinNamespace(namespaceDescriptor,
|
return new JavaScopeForKotlinNamespace(namespaceDescriptor,
|
||||||
createDeclarationForKotlinNamespace(psiPackage, psiClass, fqName),
|
createDeclarationForKotlinNamespace(psiPackage, psiClass),
|
||||||
fqName, javaSemanticServices);
|
fqName, javaSemanticServices);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user