Use of getFqName instead of JetPsiUtils
This commit is contained in:
@@ -22,7 +22,9 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetEnumEntry;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedDeclaration;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.stubindex.JetClassShortNameIndex;
|
||||
|
||||
@@ -35,7 +37,7 @@ public class JetGotoClassContributor implements GotoClassContributor {
|
||||
public String getQualifiedName(NavigationItem item) {
|
||||
if (item instanceof JetNamedDeclaration) {
|
||||
JetNamedDeclaration jetClass = (JetNamedDeclaration) item;
|
||||
FqName name = JetPsiUtil.getFQName(jetClass);
|
||||
FqName name = jetClass.getFqName();
|
||||
if (name != null) {
|
||||
return name.asString();
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
}
|
||||
|
||||
for (JetClassOrObject classOrObject : classOrObjects) {
|
||||
FqName fqName = JetPsiUtil.getFQName(classOrObject);
|
||||
FqName fqName = classOrObject.getFqName();
|
||||
if (fqName != null) {
|
||||
assert fqName.shortName().asString().equals(name) : "A declaration obtained from index has non-matching name:\n" +
|
||||
"in index: " + name + "\n" +
|
||||
@@ -195,7 +195,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
|
||||
Collection<JetObjectDeclaration> topObjects = JetTopLevelObjectShortNameIndex.getInstance().get(name, project, scope);
|
||||
for (JetObjectDeclaration objectDeclaration : topObjects) {
|
||||
FqName fqName = JetPsiUtil.getFQName(objectDeclaration);
|
||||
FqName fqName = objectDeclaration.getFqName();
|
||||
assert fqName != null : "Local object declaration in JetTopLevelShortObjectNameIndex:" + objectDeclaration.getText();
|
||||
result.addAll(ResolveSessionUtils.getClassOrObjectDescriptorsByFqName(resolveSession, fqName, ResolveSessionUtils.SINGLETON_FILTER));
|
||||
}
|
||||
@@ -340,7 +340,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
|
||||
for (PsiElement extensionFunction : extensionFunctions) {
|
||||
if (extensionFunction instanceof JetNamedFunction) {
|
||||
functionFQNs.add(JetPsiUtil.getFQName((JetNamedFunction) extensionFunction));
|
||||
functionFQNs.add(((JetNamedFunction) extensionFunction).getFqName());
|
||||
}
|
||||
else if (extensionFunction instanceof PsiMethod) {
|
||||
FqName functionFQN =
|
||||
|
||||
@@ -248,7 +248,7 @@ public class JetSourceNavigationHelper {
|
||||
|
||||
@Nullable
|
||||
private static JetClassOrObject getSourceForNamedClassOrObject(@NotNull JetClassOrObject decompiledClassOrObject) {
|
||||
FqName classFqName = JetPsiUtil.getFQName(decompiledClassOrObject);
|
||||
FqName classFqName = decompiledClassOrObject.getFqName();
|
||||
assert classFqName != null;
|
||||
|
||||
GlobalSearchScope librarySourcesScope = createLibrarySourcesScope(decompiledClassOrObject);
|
||||
@@ -265,7 +265,7 @@ public class JetSourceNavigationHelper {
|
||||
|
||||
@NotNull
|
||||
private static Collection<JetNamedDeclaration> getInitialTopLevelCandidates(@NotNull JetNamedDeclaration decompiledDeclaration) {
|
||||
FqName memberFqName = JetPsiUtil.getFQName(decompiledDeclaration);
|
||||
FqName memberFqName = decompiledDeclaration.getFqName();
|
||||
assert memberFqName != null;
|
||||
|
||||
GlobalSearchScope librarySourcesScope = createLibrarySourcesScope(decompiledDeclaration);
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public class JetDefaultNamedDeclarationPresentation implements ColoredItemPresen
|
||||
|
||||
@Override
|
||||
public String getLocationString() {
|
||||
FqName name = JetPsiUtil.getFQName(declaration);
|
||||
FqName name = declaration.getFqName();
|
||||
if (name != null) {
|
||||
return "(" + name.parent().toString() + ")";
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.intellij.navigation.ItemPresentationProvider;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jetbrains.jet.lang.psi.JetNamedFunction;
|
||||
import org.jetbrains.jet.lang.psi.JetParameter;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.psi.JetTypeReference;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
@@ -60,7 +59,7 @@ public class JetFunctionPresenter implements ItemPresentationProvider<JetNamedFu
|
||||
|
||||
@Override
|
||||
public String getLocationString() {
|
||||
FqName name = JetPsiUtil.getFQName(function);
|
||||
FqName name = function.getFqName();
|
||||
if (name != null) {
|
||||
JetTypeReference receiverTypeRef = function.getReceiverTypeRef();
|
||||
String extensionLocation = receiverTypeRef != null ? "for " + receiverTypeRef.getText() + " " : "";
|
||||
|
||||
@@ -77,7 +77,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetFunction>
|
||||
}
|
||||
|
||||
String functionName = element.getName();
|
||||
FqName fqName = JetPsiUtil.getFQName(element);
|
||||
FqName fqName = element.getFqName();
|
||||
if (fqName != null) functionName = fqName.asString();
|
||||
|
||||
if (KotlinBuiltIns.getInstance().isUnit(type) && element.hasBlockBody()) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class ChangeParameterTypeFix extends JetIntentionAction<JetParameter> {
|
||||
renderedType = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(type);
|
||||
JetNamedDeclaration declaration = PsiTreeUtil.getParentOfType(element, JetNamedDeclaration.class);
|
||||
isPrimaryConstructorParameter = declaration instanceof JetClass;
|
||||
FqName declarationFQName = declaration == null ? null : JetPsiUtil.getFQName(declaration);
|
||||
FqName declarationFQName = declaration == null ? null : declaration.getFqName();
|
||||
containingDeclarationName = declarationFQName == null ? null : declarationFQName.asString();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ package org.jetbrains.jet.plugin.quickfix;
|
||||
import com.intellij.codeInsight.intention.IntentionAction;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
@@ -58,7 +57,7 @@ public class ChangeVariableTypeFix extends JetIntentionAction<JetVariableDeclara
|
||||
@Override
|
||||
public String getText() {
|
||||
String propertyName = element.getName();
|
||||
FqName fqName = JetPsiUtil.getFQName(element);
|
||||
FqName fqName = element.getFqName();
|
||||
if (fqName != null) propertyName = fqName.asString();
|
||||
|
||||
return JetBundle.message("change.element.type", propertyName, renderedType);
|
||||
|
||||
@@ -107,7 +107,7 @@ public fun PsiElement.getKotlinFqName(): FqName? {
|
||||
val prefix = element.getContainingClass()?.getQualifiedName()
|
||||
FqName(if (prefix != null) "$prefix.$name" else name)
|
||||
}
|
||||
is JetNamedDeclaration -> JetPsiUtil.getFQName(element)
|
||||
is JetNamedDeclaration -> element.getFqName()
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -27,7 +27,6 @@ import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.ProjectDescriptorWithStdlibSources;
|
||||
|
||||
@@ -95,7 +94,7 @@ public class NavigateToStdlibSourceRegressionTest extends NavigateToLibraryRegre
|
||||
assertEquals(expectedName, ((PsiClass) element).getQualifiedName());
|
||||
}
|
||||
else if (element instanceof JetClass) {
|
||||
FqName name = JetPsiUtil.getFQName((JetClass) element);
|
||||
FqName name = ((JetClass) element).getFqName();
|
||||
assert name != null;
|
||||
assertEquals(expectedName, name.asString());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user