Renamed Name.getName() and FqName.getFqName() to asString()
This commit is contained in:
@@ -44,11 +44,11 @@ public class JetPluginUtil {
|
||||
|
||||
LinkedList<String> fullName = Lists.newLinkedList();
|
||||
while (declarationDescriptor != null && !(declarationDescriptor instanceof ModuleDescriptor)) {
|
||||
fullName.addFirst(declarationDescriptor.getName().getName());
|
||||
fullName.addFirst(declarationDescriptor.getName().asString());
|
||||
declarationDescriptor = declarationDescriptor.getContainingDeclaration();
|
||||
}
|
||||
assert fullName.size() > 0;
|
||||
if (JavaDescriptorResolver.JAVA_ROOT.getName().equals(fullName.getFirst())) {
|
||||
if (JavaDescriptorResolver.JAVA_ROOT.asString().equals(fullName.getFirst())) {
|
||||
fullName.removeFirst();
|
||||
}
|
||||
return fullName;
|
||||
|
||||
@@ -107,7 +107,7 @@ public class JetAddImportAction implements QuestionAction {
|
||||
return FINAL_CHOICE;
|
||||
}
|
||||
|
||||
List<String> toExclude = AddImportAction.getAllExcludableStrings(selectedValue.getFqName());
|
||||
List<String> toExclude = AddImportAction.getAllExcludableStrings(selectedValue.asString());
|
||||
|
||||
return new BaseListPopupStep<String>(null, toExclude) {
|
||||
@NotNull
|
||||
@@ -135,7 +135,7 @@ public class JetAddImportAction implements QuestionAction {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getTextFor(FqName value) {
|
||||
return value.getFqName();
|
||||
return value.asString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,7 @@ public class JetGotoClassContributor implements GotoClassContributor {
|
||||
JetNamedDeclaration jetClass = (JetNamedDeclaration) item;
|
||||
FqName name = JetPsiUtil.getFQName(jetClass);
|
||||
if (name != null) {
|
||||
return name.getFqName();
|
||||
return name.asString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
Collection<FqName> fqNames = packageClasses.get(name);
|
||||
if (!fqNames.isEmpty()) {
|
||||
for (FqName fqName : fqNames) {
|
||||
PsiClass psiClass = JavaElementFinder.getInstance(project).findClass(fqName.getFqName(), scope);
|
||||
PsiClass psiClass = JavaElementFinder.getInstance(project).findClass(fqName.asString(), scope);
|
||||
if (psiClass != null) {
|
||||
result.add(psiClass);
|
||||
}
|
||||
@@ -123,10 +123,10 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
for (JetClassOrObject classOrObject : classOrObjects) {
|
||||
FqName fqName = JetPsiUtil.getFQName(classOrObject);
|
||||
if (fqName != null) {
|
||||
assert fqName.shortName().getName().equals(name) : "A declaration obtained from index has non-matching name:\n" +
|
||||
assert fqName.shortName().asString().equals(name) : "A declaration obtained from index has non-matching name:\n" +
|
||||
"in index: " + name + "\n" +
|
||||
"declared: " + fqName.shortName() + "(" + fqName + ")";
|
||||
PsiClass psiClass = JavaElementFinder.getInstance(project).findClass(fqName.getFqName(), scope);
|
||||
PsiClass psiClass = JavaElementFinder.getInstance(project).findClass(fqName.asString(), scope);
|
||||
if (psiClass != null) {
|
||||
result.add(psiClass);
|
||||
}
|
||||
@@ -230,7 +230,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
Set<FunctionDescriptor> result = Sets.newHashSet();
|
||||
|
||||
Collection<PsiMethod> topLevelFunctionPrototypes = JetFromJavaDescriptorHelper.getTopLevelFunctionPrototypesByName(
|
||||
referenceName.getName(), project, scope);
|
||||
referenceName.asString(), project, scope);
|
||||
for (PsiMethod method : topLevelFunctionPrototypes) {
|
||||
FqName functionFQN = JetFromJavaDescriptorHelper.getJetTopLevelDeclarationFQN(method);
|
||||
if (functionFQN != null) {
|
||||
@@ -246,7 +246,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
}
|
||||
|
||||
Set<FqName> affectedPackages = Sets.newHashSet();
|
||||
Collection<JetNamedFunction> jetNamedFunctions = JetShortFunctionNameIndex.getInstance().get(referenceName.getName(), project, scope);
|
||||
Collection<JetNamedFunction> jetNamedFunctions = JetShortFunctionNameIndex.getInstance().get(referenceName.asString(), project, scope);
|
||||
for (JetNamedFunction jetNamedFunction : jetNamedFunctions) {
|
||||
PsiFile containingFile = jetNamedFunction.getContainingFile();
|
||||
if (containingFile instanceof JetFile) {
|
||||
@@ -354,7 +354,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
|
||||
for (String fqName : JetFullClassNameIndex.getInstance().getAllKeys(project)) {
|
||||
FqName classFQName = new FqName(fqName);
|
||||
if (acceptedShortNameCondition.value(classFQName.shortName().getName())) {
|
||||
if (acceptedShortNameCondition.value(classFQName.shortName().asString())) {
|
||||
classDescriptors.addAll(getJetClassesDescriptorsByFQName(analyzer, classFQName));
|
||||
}
|
||||
}
|
||||
@@ -364,7 +364,7 @@ public class JetShortNamesCache extends PsiShortNamesCache {
|
||||
|
||||
private Collection<ClassDescriptor> getJetClassesDescriptorsByFQName(@NotNull KotlinCodeAnalyzer analyzer, @NotNull FqName classFQName) {
|
||||
Collection<JetClassOrObject> jetClassOrObjects = JetFullClassNameIndex.getInstance().get(
|
||||
classFQName.getFqName(), project, GlobalSearchScope.allScope(project));
|
||||
classFQName.asString(), project, GlobalSearchScope.allScope(project));
|
||||
|
||||
if (jetClassOrObjects.isEmpty()) {
|
||||
// This fqn is absent in caches, dead or not in scope
|
||||
|
||||
+6
-8
@@ -31,11 +31,9 @@ import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.asJava.KotlinLightClassForExplicitDeclaration;
|
||||
import org.jetbrains.jet.asJava.LightClassConstructionContext;
|
||||
import org.jetbrains.jet.asJava.LightClassGenerationSupport;
|
||||
import org.jetbrains.jet.codegen.binding.PsiCodegenPredictor;
|
||||
import org.jetbrains.jet.lang.psi.JetClassOrObject;
|
||||
import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.lang.resolve.java.JvmClassName;
|
||||
import org.jetbrains.jet.lang.resolve.java.PackageClassUtils;
|
||||
import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
import org.jetbrains.jet.plugin.libraries.JetSourceNavigationHelper;
|
||||
@@ -70,13 +68,13 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetClassOrObject> findClassOrObjectDeclarations(@NotNull FqName fqName, @NotNull GlobalSearchScope searchScope) {
|
||||
return JetFullClassNameIndex.getInstance().get(fqName.getFqName(), project, kotlinSources(searchScope));
|
||||
return JetFullClassNameIndex.getInstance().get(fqName.asString(), project, kotlinSources(searchScope));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<JetFile> findFilesForPackage(@NotNull final FqName fqName, @NotNull GlobalSearchScope searchScope) {
|
||||
Collection<JetFile> files = JetAllPackagesIndex.getInstance().get(fqName.getFqName(), project, kotlinSources(searchScope));
|
||||
Collection<JetFile> files = JetAllPackagesIndex.getInstance().get(fqName.asString(), project, kotlinSources(searchScope));
|
||||
return ContainerUtil.filter(files, new Condition<JetFile>() {
|
||||
@Override
|
||||
public boolean value(JetFile file) {
|
||||
@@ -90,20 +88,20 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
||||
public Collection<JetClassOrObject> findClassOrObjectDeclarationsInPackage(
|
||||
@NotNull FqName packageFqName, @NotNull GlobalSearchScope searchScope
|
||||
) {
|
||||
return JetClassByPackageIndex.getInstance().get(packageFqName.getFqName(), project, kotlinSources(searchScope));
|
||||
return JetClassByPackageIndex.getInstance().get(packageFqName.asString(), project, kotlinSources(searchScope));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean packageExists(
|
||||
@NotNull FqName fqName, @NotNull GlobalSearchScope scope
|
||||
) {
|
||||
return !JetAllPackagesIndex.getInstance().get(fqName.getFqName(), project, kotlinSources(scope)).isEmpty();
|
||||
return !JetAllPackagesIndex.getInstance().get(fqName.asString(), project, kotlinSources(scope)).isEmpty();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<FqName> getSubPackages(@NotNull FqName fqn, @NotNull GlobalSearchScope scope) {
|
||||
Collection<JetFile> files = JetAllPackagesIndex.getInstance().get(fqn.getFqName(), project, kotlinSources(scope));
|
||||
Collection<JetFile> files = JetAllPackagesIndex.getInstance().get(fqn.asString(), project, kotlinSources(scope));
|
||||
|
||||
Set<FqName> result = Sets.newHashSet();
|
||||
for (JetFile file : files) {
|
||||
@@ -141,7 +139,7 @@ public class IDELightClassGenerationSupport extends LightClassGenerationSupport
|
||||
Collection<JetFile> files = findFilesForPackage(new FqName(packageFqName), scope);
|
||||
if (!files.isEmpty()) {
|
||||
FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(new FqName(packageFqName));
|
||||
result.putValue(packageClassFqName.shortName().getName(), packageClassFqName);
|
||||
result.putValue(packageClassFqName.shortName().asString(), packageClassFqName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ public class ReferenceToClassesShortening {
|
||||
}
|
||||
|
||||
private void compactReferenceToClass(JetUserType userType, ClassDescriptor targetClass) {
|
||||
String name = targetClass.getName().getName();
|
||||
String name = targetClass.getName().asString();
|
||||
DeclarationDescriptor parent = targetClass.getContainingDeclaration();
|
||||
while (parent instanceof ClassDescriptor) {
|
||||
name = parent.getName() + "." + name;
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.jetbrains.jet.lang.resolve.java.JvmStdlibNames;
|
||||
import org.jetbrains.jet.lang.resolve.java.resolver.JavaAnnotationResolver;
|
||||
|
||||
class KotlinSignatureUtil {
|
||||
static final String KOTLIN_SIGNATURE_ANNOTATION = JvmStdlibNames.KOTLIN_SIGNATURE.getFqName().getFqName();
|
||||
static final String KOTLIN_SIGNATURE_ANNOTATION = JvmStdlibNames.KOTLIN_SIGNATURE.getFqName().asString();
|
||||
|
||||
private KotlinSignatureUtil() {
|
||||
}
|
||||
|
||||
@@ -68,9 +68,9 @@ public final class DescriptorLookupConverter {
|
||||
}
|
||||
|
||||
LookupElementBuilder element = LookupElementBuilder.create(
|
||||
new JetLookupObject(descriptor, analyzer, declaration), descriptor.getName().getName());
|
||||
new JetLookupObject(descriptor, analyzer, declaration), descriptor.getName().asString());
|
||||
|
||||
String presentableText = descriptor.getName().getName();
|
||||
String presentableText = descriptor.getName().asString();
|
||||
String typeText = "";
|
||||
String tailText = "";
|
||||
boolean tailTextGrayed = true;
|
||||
|
||||
@@ -227,7 +227,7 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
for (JetSimpleNameExpression nameExpression : simpleNameExpressions) {
|
||||
Name referencedName = nameExpression.getReferencedNameAsName();
|
||||
if (fqName == null) {
|
||||
fqName = new FqName(referencedName.getName());
|
||||
fqName = new FqName(referencedName.asString());
|
||||
} else {
|
||||
fqName = QualifiedNamesUtil.combine(fqName, referencedName);
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
|
||||
private static String getDescriptorString(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
return DescriptorUtils.getFQName(descriptor).getFqName();
|
||||
return DescriptorUtils.getFQName(descriptor).asString();
|
||||
}
|
||||
else if (descriptor instanceof ConstructorDescriptor) {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
|
||||
@@ -166,7 +166,7 @@ public class IdeRenderers {
|
||||
DeclarationDescriptor containingDeclaration = funDescriptor.getContainingDeclaration();
|
||||
if (containingDeclaration != null) {
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration);
|
||||
stringBuilder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : fqName.getFqName());
|
||||
stringBuilder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : fqName.asString());
|
||||
}
|
||||
stringBuilder.append("</li>");
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ public class JetSourceNavigationHelper {
|
||||
return null;
|
||||
}
|
||||
Collection<JetClassOrObject> classes = JetFullClassNameIndex.getInstance()
|
||||
.get(classFqName.getFqName(), decompiledClassOrObject.getProject(), librarySourcesScope);
|
||||
.get(classFqName.asString(), decompiledClassOrObject.getProject(), librarySourcesScope);
|
||||
if (classes.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ public class JetSourceNavigationHelper {
|
||||
//noinspection unchecked
|
||||
StringStubIndexExtension<JetNamedDeclaration> index =
|
||||
(StringStubIndexExtension<JetNamedDeclaration>) getIndexForTopLevelPropertyOrFunction(decompiledDeclaration);
|
||||
return index.get(memberFqName.getFqName(), decompiledDeclaration.getProject(), librarySourcesScope);
|
||||
return index.get(memberFqName.asString(), decompiledDeclaration.getProject(), librarySourcesScope);
|
||||
}
|
||||
|
||||
private static StringStubIndexExtension<? extends JetNamedDeclaration> getIndexForTopLevelPropertyOrFunction(
|
||||
@@ -360,7 +360,7 @@ public class JetSourceNavigationHelper {
|
||||
if (javaAnalog.getSort() != Type.OBJECT) {
|
||||
return null;
|
||||
}
|
||||
String fqName = JvmClassName.byType(javaAnalog).getFqName().getFqName();
|
||||
String fqName = JvmClassName.byType(javaAnalog).getFqName().asString();
|
||||
return JavaPsiFacade.getInstance(classOrObject.getProject()).
|
||||
findClass(fqName, GlobalSearchScope.allScope(classOrObject.getProject()));
|
||||
}
|
||||
@@ -378,7 +378,7 @@ public class JetSourceNavigationHelper {
|
||||
if (className == null) {
|
||||
return null;
|
||||
}
|
||||
String fqName = className.getFqName().getFqName();
|
||||
String fqName = className.getFqName().asString();
|
||||
|
||||
JetFile file = (JetFile) classOrObject.getContainingFile();
|
||||
|
||||
|
||||
@@ -84,10 +84,10 @@ public class MemberMatching {
|
||||
int parameterCount = type.getParameters().size();
|
||||
|
||||
if (type.getReceiverTypeRef() == null) {
|
||||
return builtIns.getFunction(parameterCount).getName().getName();
|
||||
return builtIns.getFunction(parameterCount).getName().asString();
|
||||
}
|
||||
else {
|
||||
return builtIns.getExtensionFunction(parameterCount).getName().getName();
|
||||
return builtIns.getExtensionFunction(parameterCount).getName().asString();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class AddFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
String subjectSuffix = newParametersCnt > 1 ? "s" : "";
|
||||
|
||||
if (functionDescriptor instanceof ConstructorDescriptor) {
|
||||
String className = functionDescriptor.getContainingDeclaration().getName().getName();
|
||||
String className = functionDescriptor.getContainingDeclaration().getName().asString();
|
||||
|
||||
if (hasTypeMismatches)
|
||||
return JetBundle.message("change.constructor.signature", className);
|
||||
@@ -73,7 +73,7 @@ public class AddFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
return JetBundle.message("add.parameters.to.constructor", subjectSuffix, className);
|
||||
}
|
||||
else {
|
||||
String functionName = functionDescriptor.getName().getName();
|
||||
String functionName = functionDescriptor.getName().asString();
|
||||
|
||||
if (hasTypeMismatches)
|
||||
return JetBundle.message("change.function.signature", functionName);
|
||||
@@ -95,7 +95,7 @@ public class AddFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
JetExpression expression = argument.getArgumentExpression();
|
||||
|
||||
if (i < parameters.size()) {
|
||||
validator.validateName(parameters.get(i).getName().getName());
|
||||
validator.validateName(parameters.get(i).getName().asString());
|
||||
JetType argumentType = expression != null ? bindingContext.get(BindingContext.EXPRESSION_TYPE, expression) : null;
|
||||
JetType parameterType = parameters.get(i).getType();
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AddNameToArgumentFix extends JetIntentionAction<JetValueArgument> {
|
||||
Set<String> usedParameters = getUsedParameters(callElement, callableDescriptor);
|
||||
List<String> names = Lists.newArrayList();
|
||||
for (ValueParameterDescriptor parameter: callableDescriptor.getValueParameters()) {
|
||||
String name = parameter.getName().getName();
|
||||
String name = parameter.getName().asString();
|
||||
if (usedParameters.contains(name)) continue;
|
||||
if (type == null || JetTypeChecker.INSTANCE.isSubtypeOf(type, parameter.getType())) {
|
||||
names.add(name);
|
||||
@@ -98,7 +98,7 @@ public class AddNameToArgumentFix extends JetIntentionAction<JetValueArgument> {
|
||||
}
|
||||
else if (isPositionalArgument) {
|
||||
ValueParameterDescriptor parameter = callableDescriptor.getValueParameters().get(idx);
|
||||
usedParameters.add(parameter.getName().getName());
|
||||
usedParameters.add(parameter.getName().asString());
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
|
||||
}
|
||||
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
String hintText = ShowAutoImportPass.getMessage(suggestions.size() > 1, suggestions.iterator().next().getFqName());
|
||||
String hintText = ShowAutoImportPass.getMessage(suggestions.size() > 1, suggestions.iterator().next().asString());
|
||||
|
||||
HintManager.getInstance().showQuestionHint(
|
||||
editor, hintText,
|
||||
|
||||
@@ -28,7 +28,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.lang.descriptors.CallableDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.descriptors.SimpleFunctionDescriptor;
|
||||
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
|
||||
import org.jetbrains.jet.lang.diagnostics.DiagnosticWithParameters3;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
@@ -58,7 +57,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetNamedFunc
|
||||
public String getText() {
|
||||
String functionName = element.getName();
|
||||
FqName fqName = JetPsiUtil.getFQName(element);
|
||||
if (fqName != null) functionName = fqName.getFqName();
|
||||
if (fqName != null) functionName = fqName.asString();
|
||||
|
||||
if (KotlinBuiltIns.getInstance().isUnit(type) && element.hasBlockBody()) {
|
||||
return functionName == null ?
|
||||
@@ -98,7 +97,7 @@ public class ChangeFunctionReturnTypeFix extends JetIntentionAction<JetNamedFunc
|
||||
|
||||
@NotNull
|
||||
public static JetMultiDeclarationEntry getMultiDeclarationEntryThatTypeMismatchComponentFunction(Diagnostic diagnostic) {
|
||||
String componentName = ((DiagnosticWithParameters3<JetExpression, Name, JetType, JetType>) diagnostic).getA().getName();
|
||||
String componentName = ((DiagnosticWithParameters3<JetExpression, Name, JetType, JetType>) diagnostic).getA().asString();
|
||||
int componentIndex = Integer.valueOf(componentName.substring(DescriptorResolver.COMPONENT_FUNCTION_NAME_PREFIX.length()));
|
||||
JetMultiDeclaration multiDeclaration = QuickFixUtil.getParentElementOfType(diagnostic, JetMultiDeclaration.class);
|
||||
assert multiDeclaration != null : "COMPONENT_FUNCTION_RETURN_TYPE_MISMATCH reported on expression that is not within any multi declaration";
|
||||
|
||||
@@ -87,7 +87,7 @@ public class ImportInsertHelper {
|
||||
boolean same = file.getManager().areElementsEquivalent(target, targetElement);
|
||||
|
||||
if (!same) {
|
||||
same = target instanceof PsiClass && importFqn.getFqName().equals(((PsiClass)target).getQualifiedName());
|
||||
same = target instanceof PsiClass && importFqn.asString().equals(((PsiClass)target).getQualifiedName());
|
||||
}
|
||||
|
||||
if (!same) {
|
||||
@@ -106,7 +106,7 @@ public class ImportInsertHelper {
|
||||
if (!same) {
|
||||
Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
|
||||
TextRange refRange = reference.getElement().getTextRange();
|
||||
document.replaceString(refRange.getStartOffset(), refRange.getEndOffset(), importFqn.getFqName());
|
||||
document.replaceString(refRange.getStartOffset(), refRange.getEndOffset(), importFqn.asString());
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class MakeOverriddenMemberOpenFix extends JetIntentionAction<JetDeclarati
|
||||
if (overriddenMember == null || !QuickFixUtil.canModifyElement(overriddenMember)) {
|
||||
return false;
|
||||
}
|
||||
String containingDeclarationName = overriddenDescriptor.getContainingDeclaration().getName().getName();
|
||||
String containingDeclarationName = overriddenDescriptor.getContainingDeclaration().getName().asString();
|
||||
overriddenMembers.add(overriddenMember);
|
||||
containingDeclarationsNames.add(containingDeclarationName);
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ public class MapPlatformClassToKotlinFix extends JetIntentionAction<JetReference
|
||||
if (possibleClasses.size() > 1) {
|
||||
LinkedHashSet<String> possibleTypes = new LinkedHashSet<String>();
|
||||
for (ClassDescriptor klass : possibleClasses) {
|
||||
possibleTypes.add(klass.getName().getName());
|
||||
possibleTypes.add(klass.getName().asString());
|
||||
}
|
||||
buildAndShowTemplate(project, editor, file, replacedElements, possibleTypes);
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public class MapPlatformClassToKotlinFix extends JetIntentionAction<JetReference
|
||||
|
||||
private List<PsiElement> replaceUsagesWithFirstClass(Project project, List<JetUserType> usages) {
|
||||
ClassDescriptor replacementClass = possibleClasses.iterator().next();
|
||||
String replacementClassName = replacementClass.getName().getName();
|
||||
String replacementClassName = replacementClass.getName().asString();
|
||||
List<PsiElement> replacedElements = new ArrayList<PsiElement>();
|
||||
for (JetUserType usage : usages) {
|
||||
JetTypeArgumentList typeArguments = usage.getTypeArgumentList();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RemoveFunctionParametersFix extends ChangeFunctionSignatureFix {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getText() {
|
||||
return JetBundle.message("remove.parameter", parameterToRemove.getName().getName());
|
||||
return JetBundle.message("remove.parameter", parameterToRemove.getName().asString());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-2
@@ -54,9 +54,9 @@ public class RenameParameterToMatchOverriddenMethodFix extends JetIntentionActio
|
||||
}
|
||||
for (CallableDescriptor parameterFromSuperclass : parameterDescriptor.getOverriddenDescriptors()) {
|
||||
if (parameterFromSuperclassName == null) {
|
||||
parameterFromSuperclassName = parameterFromSuperclass.getName().getName();
|
||||
parameterFromSuperclassName = parameterFromSuperclass.getName().asString();
|
||||
}
|
||||
else if (!parameterFromSuperclassName.equals(parameterFromSuperclass.getName().getName())) {
|
||||
else if (!parameterFromSuperclassName.equals(parameterFromSuperclass.getName().asString())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class JetNameSuggester {
|
||||
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(argument);
|
||||
if (classDescriptor != null) {
|
||||
Name className = classDescriptor.getName();
|
||||
addName(result, "arrayOf" + StringUtil.capitalize(className.getName()) + "s", validator);
|
||||
addName(result, "arrayOf" + StringUtil.capitalize(className.asString()) + "s", validator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class JetNameSuggester {
|
||||
ClassDescriptor classDescriptor = TypeUtils.getClassDescriptor(jetType);
|
||||
if (classDescriptor != null) {
|
||||
Name className = classDescriptor.getName();
|
||||
addCamelNames(result, className.getName(), validator);
|
||||
addCamelNames(result, className.asString(), validator);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ public class JetNameValidatorImpl extends JetNameValidator {
|
||||
Collection<DeclarationDescriptor> variants =
|
||||
TipsManager.getVariantsNoReceiver(expression, myBindingContext);
|
||||
for (DeclarationDescriptor variant : variants) {
|
||||
if (variant.getName().getName().equals(name) && variant instanceof VariableDescriptor) {
|
||||
if (variant.getName().asString().equals(name) && variant instanceof VariableDescriptor) {
|
||||
result.set(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ public class JetChangeInfo implements ChangeInfo {
|
||||
|
||||
for (int i = 0; i < parameters.size(); i++) {
|
||||
ValueParameterDescriptor oldParameter = parameters.get(i);
|
||||
map.put(oldParameter.getName().getName(), i);
|
||||
map.put(oldParameter.getName().asString(), i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -47,7 +47,7 @@ public class JetFunctionPlatformDescriptorImpl implements JetFunctionPlatformDes
|
||||
@Override
|
||||
public JetParameterInfo fun(ValueParameterDescriptor param) {
|
||||
JetParameter parameter = valueParameters.get(param.getIndex());
|
||||
return new JetParameterInfo(param.getIndex(), param.getName().getName(), param.getType(), parameter.getDefaultValue(), parameter.getValOrVarNode());
|
||||
return new JetParameterInfo(param.getIndex(), param.getName().asString(), param.getType(), parameter.getDefaultValue(), parameter.getValOrVarNode());
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -55,11 +55,11 @@ public class JetFunctionPlatformDescriptorImpl implements JetFunctionPlatformDes
|
||||
@Override
|
||||
public String getName() {
|
||||
if (funDescriptor instanceof ConstructorDescriptor)
|
||||
return funDescriptor.getContainingDeclaration().getName().getName();
|
||||
return funDescriptor.getContainingDeclaration().getName().asString();
|
||||
else if (funDescriptor instanceof AnonymousFunctionDescriptor)
|
||||
return "";
|
||||
else
|
||||
return funDescriptor.getName().getName();
|
||||
return funDescriptor.getName().asString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -92,8 +92,8 @@ public class JetRunConfigurationProducer extends RuntimeConfigurationProducer im
|
||||
RunnerAndConfigurationSettings settings = cloneTemplateConfiguration(module.getProject(), context);
|
||||
JetRunConfiguration configuration = (JetRunConfiguration) settings.getConfiguration();
|
||||
configuration.setModule(module);
|
||||
configuration.setName(StringUtil.trimEnd(fqName.getFqName(), "." + PackageClassUtils.getPackageClassName(fqName)));
|
||||
configuration.setRunClass(fqName.getFqName());
|
||||
configuration.setName(StringUtil.trimEnd(fqName.asString(), "." + PackageClassUtils.getPackageClassName(fqName)));
|
||||
configuration.setRunClass(fqName.asString());
|
||||
return settings;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class JetRunConfigurationProducer extends RuntimeConfigurationProducer im
|
||||
for (RunnerAndConfigurationSettings existingConfiguration : existingConfigurations) {
|
||||
if (existingConfiguration.getType() instanceof JetRunConfigurationType) {
|
||||
JetRunConfiguration jetConfiguration = (JetRunConfiguration)existingConfiguration.getConfiguration();
|
||||
if (Comparing.equal(jetConfiguration.getRunClass(), startClassFQName.getFqName())) {
|
||||
if (Comparing.equal(jetConfiguration.getRunClass(), startClassFQName.asString())) {
|
||||
if (Comparing.equal(location.getModule(), jetConfiguration.getConfigurationModule().getModule())) {
|
||||
return existingConfiguration;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class KotlinAnnotatedElementsSearcher extends AnnotatedElementsSearcher {
|
||||
|
||||
ClassifierDescriptor descriptor = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
|
||||
if (descriptor == null) return;
|
||||
if (!(DescriptorUtils.getFQName(descriptor).getFqName().equals(annotationFQN))) return;
|
||||
if (!(DescriptorUtils.getFQName(descriptor).asString().equals(annotationFQN))) return;
|
||||
|
||||
if (parentOfType instanceof JetClass) {
|
||||
PsiClass lightClass = LightClassUtil.getPsiClass((JetClass) parentOfType);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class KotlinDirectInheritorsSearcher extends QueryExecutorBase<PsiClass,
|
||||
for (JetType type : classDescriptor.getTypeConstructor().getSupertypes()) {
|
||||
ClassifierDescriptor declarationDescriptor = type.getConstructor().getDeclarationDescriptor();
|
||||
if (declarationDescriptor != null) {
|
||||
String fqName = DescriptorUtils.getFQName(declarationDescriptor).getFqName();
|
||||
String fqName = DescriptorUtils.getFQName(declarationDescriptor).asString();
|
||||
if (qualifiedName.equals(fqName)) {
|
||||
PsiClass psiClass = JetSourceNavigationHelper.getOriginalPsiClassOrCreateLightClass(candidate);
|
||||
if (psiClass != null) {
|
||||
|
||||
@@ -218,11 +218,11 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
||||
else if (descriptor instanceof VariableDescriptor) {
|
||||
JetType outType = ((VariableDescriptor) descriptor).getType();
|
||||
|
||||
textBuilder = new StringBuilder(descriptor.getName().getName());
|
||||
textBuilder = new StringBuilder(descriptor.getName().asString());
|
||||
textBuilder.append(":").append(DescriptorRenderer.TEXT.renderType(outType));
|
||||
}
|
||||
else if (descriptor instanceof ClassDescriptor) {
|
||||
textBuilder = new StringBuilder(descriptor.getName().getName());
|
||||
textBuilder = new StringBuilder(descriptor.getName().asString());
|
||||
textBuilder
|
||||
.append(" (")
|
||||
.append(DescriptorUtils.getFQName(descriptor.getContainingDeclaration()))
|
||||
|
||||
@@ -33,7 +33,7 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
FqName fqName = new FqName(packageName == null ? "" : packageName);
|
||||
|
||||
while (true) {
|
||||
sink.occurrence(JetAllPackagesIndex.getInstance().getKey(), fqName.getFqName());
|
||||
sink.occurrence(JetAllPackagesIndex.getInstance().getKey(), fqName.asString());
|
||||
if (fqName.isRoot()) {
|
||||
return;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
|
||||
FqName fqn = stub.getFqName();
|
||||
if (fqn != null) {
|
||||
sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqn.getFqName());
|
||||
sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqn.asString());
|
||||
}
|
||||
|
||||
for (String superName : stub.getSuperNames()) {
|
||||
@@ -87,7 +87,7 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
}
|
||||
|
||||
if (fqName != null) {
|
||||
sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqName.getFqName());
|
||||
sink.occurrence(JetFullClassNameIndex.getInstance().getKey(), fqName.asString());
|
||||
}
|
||||
|
||||
recordClassOrObjectByPackage(stub, sink);
|
||||
@@ -119,7 +119,7 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
|
||||
FqName topFQName = stub.getTopFQName();
|
||||
if (topFQName != null) {
|
||||
sink.occurrence(JetTopLevelFunctionsFqnNameIndex.getInstance().getKey(), topFQName.getFqName());
|
||||
sink.occurrence(JetTopLevelFunctionsFqnNameIndex.getInstance().getKey(), topFQName.asString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class StubIndexServiceImpl implements StubIndexService {
|
||||
if (stub.isTopLevel()) {
|
||||
FqName topFQName = stub.getTopFQName();
|
||||
if (topFQName != null) {
|
||||
sink.occurrence(JetTopLevelPropertiesFqnNameIndex.getInstance().getKey(), topFQName.getFqName());
|
||||
sink.occurrence(JetTopLevelPropertiesFqnNameIndex.getInstance().getKey(), topFQName.asString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public class KotlinRuntimeLibraryUtil {
|
||||
@Nullable
|
||||
public static PsiClass getKotlinRuntimeMarkerClass(@NotNull GlobalSearchScope scope) {
|
||||
FqName kotlinPackageFqName = FqName.topLevel(Name.identifier("kotlin"));
|
||||
String kotlinPackageClassFqName = PackageClassUtils.getPackageClassFqName(kotlinPackageFqName).getFqName();
|
||||
String kotlinPackageClassFqName = PackageClassUtils.getPackageClassFqName(kotlinPackageFqName).asString();
|
||||
|
||||
ImmutableList<String> candidateClassNames = ImmutableList.of(
|
||||
kotlinPackageClassFqName,
|
||||
|
||||
@@ -224,7 +224,7 @@ public class OverrideImplementTest extends LightCodeInsightFixtureTestCase {
|
||||
else {
|
||||
CallableMemberDescriptor candidateToOverride = null;
|
||||
for (CallableMemberDescriptor callable : descriptors) {
|
||||
if (callable.getName().getName().equals(memberToOverride)) {
|
||||
if (callable.getName().asString().equals(memberToOverride)) {
|
||||
if (candidateToOverride != null) {
|
||||
throw new IllegalStateException("more then one descriptor with name " + memberToOverride);
|
||||
}
|
||||
|
||||
+1
-3
@@ -22,7 +22,6 @@ import com.intellij.openapi.roots.ContentEntry;
|
||||
import com.intellij.openapi.roots.ModifiableRootModel;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.roots.libraries.Library;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -33,7 +32,6 @@ import com.intellij.testFramework.LightPlatformTestCase;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.jet.codegen.binding.PsiCodegenPredictor;
|
||||
import org.jetbrains.jet.lang.psi.JetClass;
|
||||
import org.jetbrains.jet.lang.psi.JetPsiUtil;
|
||||
import org.jetbrains.jet.plugin.JetWithJdkAndRuntimeLightProjectDescriptor;
|
||||
@@ -98,7 +96,7 @@ public class NavigateToStdlibSourceRegressionTest extends NavigateToLibraryRegre
|
||||
assertEquals(expectedName, ((PsiClass) element).getQualifiedName());
|
||||
}
|
||||
else if (element instanceof JetClass) {
|
||||
assertEquals(expectedName, JetPsiUtil.getFQName((JetClass) element).getFqName());
|
||||
assertEquals(expectedName, JetPsiUtil.getFQName((JetClass) element).asString());
|
||||
}
|
||||
else {
|
||||
fail("Navigation element should be JetClass or PsiClass: " + element.getClass() + ", " + element.getText());
|
||||
|
||||
@@ -74,7 +74,7 @@ public class BuiltInsReferenceResolverTest extends ResolveTestCase {
|
||||
public void testAllReferencesResolved() {
|
||||
BuiltInsReferenceResolver referenceResolver = getProject().getComponent(BuiltInsReferenceResolver.class);
|
||||
for (DeclarationDescriptor descriptor : getAllStandardDescriptors(KotlinBuiltIns.getInstance().getBuiltInsPackage())) {
|
||||
if (descriptor instanceof NamespaceDescriptor && "jet".equals(descriptor.getName().getName())) continue;
|
||||
if (descriptor instanceof NamespaceDescriptor && "jet".equals(descriptor.getName().asString())) continue;
|
||||
assertNotNull("Can't resolve " + descriptor, referenceResolver.resolveStandardLibrarySymbol(descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user