Renamed Name.getName() and FqName.getFqName() to asString()

This commit is contained in:
Evgeny Gerashchenko
2013-05-21 17:56:04 +04:00
parent de6d5a4a96
commit 43b9a9d434
140 changed files with 294 additions and 304 deletions
@@ -73,7 +73,7 @@ public class ClassDescriptorImpl extends DeclarationDescriptorNonRootImpl implem
@Nullable ConstructorDescriptor primaryConstructor,
boolean isInner
) {
this.typeConstructor = new TypeConstructorImpl(this, getAnnotations(), sealed, getName().getName(), typeParameters, supertypes);
this.typeConstructor = new TypeConstructorImpl(this, getAnnotations(), sealed, getName().asString(), typeParameters, supertypes);
this.memberDeclarations = memberDeclarations;
this.constructors = constructors;
this.primaryConstructor = primaryConstructor;
@@ -109,7 +109,7 @@ public abstract class MutableClassDescriptorLite extends ClassDescriptorBase {
this,
Collections.<AnnotationDescriptor>emptyList(), // TODO : pass annotations from the class?
!getModality().isOverridable(),
getName().getName(),
getName().asString(),
typeParameters,
supertypes);
}
@@ -91,7 +91,7 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorNonRootImp
this,
annotations,
false,
name.getName(),
name.asString(),
Collections.<TypeParameterDescriptor>emptyList(),
upperBounds);
}
@@ -64,7 +64,7 @@ public class Renderers {
@Override
public String render(@NotNull Object element) {
if (element instanceof Named) {
return ((Named) element).getName().getName();
return ((Named) element).getName().asString();
}
return element.toString();
}
@@ -299,7 +299,7 @@ public class Renderers {
StringBuilder sb = new StringBuilder();
int index = 0;
for (ClassDescriptor descriptor : descriptors) {
sb.append(DescriptorUtils.getFQName(descriptor).getFqName());
sb.append(DescriptorUtils.getFQName(descriptor).asString());
index++;
if (index <= descriptors.size() - 2) {
sb.append(", ");
@@ -199,7 +199,7 @@ public class JetClass extends JetTypeParameterListOwnerStub<PsiJetClassStub> imp
PsiJetClassStub stub = getStub();
if (stub != null) {
FqName fqName = stub.getFqName();
return fqName == null ? null : fqName.getFqName();
return fqName == null ? null : fqName.asString();
}
List<String> parts = new ArrayList<String>();
@@ -228,7 +228,7 @@ public class JetPsiFactory {
Name alias = importPath.getAlias();
if (alias != null) {
importDirectiveBuilder.append(" as ").append(alias.getName());
importDirectiveBuilder.append(" as ").append(alias.asString());
}
JetFile namespace = createFile(project, importDirectiveBuilder.toString());
@@ -408,7 +408,7 @@ public class JetPsiUtil {
return false;
}
return KotlinBuiltIns.getInstance().getUnit().getName().getName().equals(typeReference.getText());
return KotlinBuiltIns.getInstance().getUnit().getName().asString().equals(typeReference.getText());
}
public static boolean isSafeCall(@NotNull Call call) {
@@ -694,7 +694,7 @@ public class JetPsiUtil {
public static boolean checkVariableDeclarationInBlock(@NotNull JetBlockExpression block, @NotNull String varName) {
for (JetElement element : block.getStatements()) {
if (element instanceof JetVariableDeclaration) {
if (((JetVariableDeclaration) element).getNameAsSafeName().getName().equals(varName)) {
if (((JetVariableDeclaration) element).getNameAsSafeName().asString().equals(varName)) {
return true;
}
}
@@ -50,7 +50,7 @@ public class JetAnnotationElementType extends JetStubElementType<PsiJetAnnotatio
@Override
public PsiJetAnnotationStub createStub(@NotNull JetAnnotationEntry psi, StubElement parentStub) {
Name shortName = JetPsiUtil.getShortName(psi);
String resultName = shortName != null ? shortName.getName() : psi.getText();
String resultName = shortName != null ? shortName.asString() : psi.getText();
return new PsiJetAnnotationStubImpl(parentStub, JetStubElementTypes.ANNOTATION_ENTRY, resultName);
}
@@ -54,7 +54,7 @@ public class JetClassElementType extends JetStubElementType<PsiJetClassStub, Jet
public PsiJetClassStub createStub(@NotNull JetClass psi, StubElement parentStub) {
FqName fqName = JetPsiUtil.getFQName(psi);
boolean isEnumEntry = psi instanceof JetEnumEntry;
return new PsiJetClassStubImpl(getStubType(isEnumEntry), parentStub, fqName != null ? fqName.getFqName() : null, psi.getName(),
return new PsiJetClassStubImpl(getStubType(isEnumEntry), parentStub, fqName != null ? fqName.asString() : null, psi.getName(),
psi.getSuperNames(), psi.isTrait(), psi.isEnum(), isEnumEntry, psi.isAnnotation(), psi.isInner());
}
@@ -62,7 +62,7 @@ public class JetClassElementType extends JetStubElementType<PsiJetClassStub, Jet
public void serialize(PsiJetClassStub stub, StubOutputStream dataStream) throws IOException {
dataStream.writeName(stub.getName());
FqName fqName = stub.getFqName();
dataStream.writeName(fqName == null ? null : fqName.getFqName());
dataStream.writeName(fqName == null ? null : fqName.asString());
dataStream.writeBoolean(stub.isTrait());
dataStream.writeBoolean(stub.isEnumClass());
dataStream.writeBoolean(stub.isEnumEntry());
@@ -93,11 +93,11 @@ public class AnnotationResolver {
ConstructorDescriptor constructor = (ConstructorDescriptor)descriptor;
ClassDescriptor classDescriptor = constructor.getContainingDeclaration();
if (classDescriptor.getKind() != ClassKind.ANNOTATION_CLASS) {
trace.report(Errors.NOT_AN_ANNOTATION_CLASS.on(entryElement, classDescriptor.getName().getName()));
trace.report(Errors.NOT_AN_ANNOTATION_CLASS.on(entryElement, classDescriptor.getName().asString()));
}
}
else {
trace.report(Errors.NOT_AN_ANNOTATION_CLASS.on(entryElement, descriptor.getName().getName()));
trace.report(Errors.NOT_AN_ANNOTATION_CLASS.on(entryElement, descriptor.getName().asString()));
}
}
JetType annotationType = results.getResultingDescriptor().getReturnType();
@@ -313,7 +313,7 @@ public class DeclarationResolver {
for (PsiElement declaration : getDeclarationsByDescriptor(declarationDescriptor)) {
assert declaration != null : "Null declaration for descriptor: " + declarationDescriptor + " " +
(declarationDescriptor != null ? DescriptorRenderer.TEXT.render(declarationDescriptor) : "");
trace.report(REDECLARATION.on(declaration, declarationDescriptor.getName().getName()));
trace.report(REDECLARATION.on(declaration, declarationDescriptor.getName().asString()));
}
}
}
@@ -402,7 +402,7 @@ public class DeclarationResolver {
}
}
for (Pair<PsiElement, Name> redeclaration : redeclarations) {
trace.report(REDECLARATION.on(redeclaration.getFirst(), redeclaration.getSecond().getName()));
trace.report(REDECLARATION.on(redeclaration.getFirst(), redeclaration.getSecond().asString()));
}
}
@@ -280,7 +280,7 @@ public class DeclarationsChecker {
boolean inEnum = classDescriptor.getKind() == ClassKind.ENUM_CLASS;
boolean inAbstractClass = classDescriptor.getModality() == Modality.ABSTRACT;
if (hasAbstractModifier && !inAbstractClass && !inEnum) {
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.getName().getName(), classDescriptor));
trace.report(ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS.on(function, functionDescriptor.getName().asString(), classDescriptor));
}
if (hasAbstractModifier && inTrait) {
trace.report(ABSTRACT_MODIFIER_IN_TRAIT.on(function));
@@ -363,7 +363,7 @@ public class DescriptorUtils {
@NotNull
public static Name getClassObjectName(@NotNull Name className) {
return getClassObjectName(className.getName());
return getClassObjectName(className.asString());
}
@NotNull
@@ -405,7 +405,7 @@ public class DescriptorUtils {
String typeSuffix = rendererForTypesIfNecessary == null
? ""
: ": " + rendererForTypesIfNecessary.renderType(value.getType(KotlinBuiltIns.getInstance()));
resultList.add(entry.getKey().getName().getName() + " = " + value.toString() + typeSuffix);
resultList.add(entry.getKey().getName().asString() + " = " + value.toString() + typeSuffix);
}
Collections.sort(resultList);
return resultList;
@@ -536,14 +536,14 @@ public class DescriptorUtils {
public static boolean isEnumValueOfMethod(@NotNull FunctionDescriptor functionDescriptor) {
List<ValueParameterDescriptor> methodTypeParameters = functionDescriptor.getValueParameters();
JetType nullableString = TypeUtils.makeNullable(KotlinBuiltIns.getInstance().getStringType());
return "valueOf".equals(functionDescriptor.getName().getName())
return "valueOf".equals(functionDescriptor.getName().asString())
&& methodTypeParameters.size() == 1
&& JetTypeChecker.INSTANCE.isSubtypeOf(methodTypeParameters.get(0).getType(), nullableString);
}
public static boolean isEnumValuesMethod(@NotNull FunctionDescriptor functionDescriptor) {
List<ValueParameterDescriptor> methodTypeParameters = functionDescriptor.getValueParameters();
return "values".equals(functionDescriptor.getName().getName())
return "values".equals(functionDescriptor.getName().asString())
&& methodTypeParameters.isEmpty();
}
@@ -50,12 +50,12 @@ public final class ImportPath {
}
public String getPathStr() {
return fqName.getFqName() + (isAllUnder ? ".*" : "");
return fqName.asString() + (isAllUnder ? ".*" : "");
}
@Override
public String toString() {
return getPathStr() + (alias != null ? " as " + alias.getName() : "");
return getPathStr() + (alias != null ? " as " + alias.asString() : "");
}
@NotNull
@@ -75,7 +75,7 @@ public class OverloadResolver {
}
Key(NamespaceDescriptor namespaceDescriptor, Name name) {
this(DescriptorUtils.getFQName(namespaceDescriptor).getFqName(), name);
this(DescriptorUtils.getFQName(namespaceDescriptor).asString(), name);
}
public String getNamespace() {
@@ -149,7 +149,7 @@ public class OverloadResolver {
}
if (jetClass instanceof JetObjectDeclaration) {
// must be class object
name = classDescriptor.getContainingDeclaration().getName().getName();
name = classDescriptor.getContainingDeclaration().getName().asString();
return "class object " + name;
}
// safe
@@ -223,7 +223,7 @@ public class OverloadResolver {
CallableMemberDescriptor memberDescriptor = redeclaration.getSecond();
JetDeclaration jetDeclaration = redeclaration.getFirst();
if (memberDescriptor instanceof PropertyDescriptor) {
trace.report(Errors.REDECLARATION.on(jetDeclaration, memberDescriptor.getName().getName()));
trace.report(Errors.REDECLARATION.on(jetDeclaration, memberDescriptor.getName().asString()));
}
else {
trace.report(Errors.CONFLICTING_OVERLOADS.on(jetDeclaration, memberDescriptor, functionContainer));
@@ -155,7 +155,7 @@ public class OverrideResolver {
public void conflict(@NotNull CallableMemberDescriptor fromSuper, @NotNull CallableMemberDescriptor fromCurrent) {
JetDeclaration declaration = (JetDeclaration) BindingContextUtils
.descriptorToDeclaration(trace.getBindingContext(), fromCurrent);
trace.report(Errors.CONFLICTING_OVERLOADS.on(declaration, fromCurrent, fromCurrent.getContainingDeclaration().getName().getName()));
trace.report(Errors.CONFLICTING_OVERLOADS.on(declaration, fromCurrent, fromCurrent.getContainingDeclaration().getName().asString()));
}
});
}
@@ -586,7 +586,7 @@ public class OverrideResolver {
private void checkOverrideForMember(@NotNull final CallableMemberDescriptor declared) {
if (declared.getKind() == CallableMemberDescriptor.Kind.SYNTHESIZED) {
// TODO: this should be replaced soon by a framework of synthesized member generation tools
if (declared.getName().getName().startsWith(DescriptorResolver.COMPONENT_FUNCTION_NAME_PREFIX)) {
if (declared.getName().asString().startsWith(DescriptorResolver.COMPONENT_FUNCTION_NAME_PREFIX)) {
checkOverrideForComponentFunction(declared);
}
return;
@@ -39,7 +39,7 @@ public class TraceBasedRedeclarationHandler implements RedeclarationHandler {
private void report(DeclarationDescriptor descriptor) {
PsiElement firstElement = BindingContextUtils.descriptorToDeclaration(trace.getBindingContext(), descriptor);
if (firstElement != null) {
trace.report(REDECLARATION.on(firstElement, descriptor.getName().getName()));
trace.report(REDECLARATION.on(firstElement, descriptor.getName().asString()));
}
else {
throw new IllegalStateException("No declaration found for " + descriptor);
@@ -342,7 +342,7 @@ public class TypeResolver {
assert size != 0 : "No projections possible for a nilary type constructor" + constructor;
ClassifierDescriptor declarationDescriptor = constructor.getDeclarationDescriptor();
assert declarationDescriptor != null : "No declaration descriptor for type constructor " + constructor;
String name = declarationDescriptor.getName().getName();
String name = declarationDescriptor.getName().asString();
return TypeUtils.getTypeNameAndStarProjectionsString(name, size);
}
@@ -51,7 +51,6 @@ import org.jetbrains.jet.lexer.JetTokens;
import javax.inject.Inject;
import java.util.Collection;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import static org.jetbrains.jet.lang.descriptors.ReceiverParameterDescriptor.NO_RECEIVER_PARAMETER;
@@ -100,7 +99,7 @@ public class CallResolver {
Name referencedName = nameExpression.getReferencedNameAsName();
List<CallableDescriptorCollector<? extends VariableDescriptor>> callableDescriptorCollectors = Lists.newArrayList();
if (nameExpression.getReferencedNameElementType() == JetTokens.FIELD_IDENTIFIER) {
referencedName = Name.identifier(referencedName.getName().substring(1));
referencedName = Name.identifier(referencedName.asString().substring(1));
callableDescriptorCollectors.add(CallableDescriptorCollectors.PROPERTIES);
}
else {
@@ -178,7 +178,7 @@ public class TracingStrategyImpl implements TracingStrategy {
JetExpression left = binaryExpression.getLeft();
JetExpression right = binaryExpression.getRight();
if (left != null && right != null) {
trace.report(UNSAFE_INFIX_CALL.on(reference, left.getText(), operationString.getName(), right.getText()));
trace.report(UNSAFE_INFIX_CALL.on(reference, left.getText(), operationString.asString(), right.getText()));
}
}
else {
@@ -124,7 +124,7 @@ public class LazyClassMemberScope extends AbstractLazyMemberScope<LazyClassDescr
fromCurrent);
assert declaration != null : "fromCurrent can not be a fake override";
trace.report(Errors.CONFLICTING_OVERLOADS
.on(declaration, fromCurrent, fromCurrent.getContainingDeclaration().getName().getName()));
.on(declaration, fromCurrent, fromCurrent.getContainingDeclaration().getName().asString()));
}
}
);
@@ -59,7 +59,7 @@ public class FqName extends FqNameBase {
private void validateFqName() {
if (!isValidAfterUnsafeCheck(fqName.getFqName())) {
if (!isValidAfterUnsafeCheck(fqName.asString())) {
throw new IllegalArgumentException("incorrect fq name: " + fqName);
}
}
@@ -71,8 +71,8 @@ public class FqName extends FqNameBase {
@Override
@NotNull
public String getFqName() {
return fqName.getFqName();
public String asString() {
return fqName.asString();
}
@NotNull
@@ -27,7 +27,7 @@ public abstract class FqNameBase {
}
@NotNull
protected abstract String getFqName();
protected abstract String asString();
@NotNull
private FqNameUnsafe toFqNameUnsafe() {
@@ -51,6 +51,6 @@ public abstract class FqNameBase {
}
public final boolean equalsTo(@NotNull String that) {
return getFqName().equals(that);
return asString().equals(that);
}
}
@@ -85,7 +85,7 @@ public class FqNameUnsafe extends FqNameBase {
@NotNull
public String getFqName() {
public String asString() {
return fqName;
}
@@ -93,7 +93,7 @@ public class FqNameUnsafe extends FqNameBase {
if (safe != null) {
return true;
}
return FqName.isValidAfterUnsafeCheck(getFqName());
return FqName.isValidAfterUnsafeCheck(asString());
}
@NotNull
@@ -128,10 +128,10 @@ public class FqNameUnsafe extends FqNameBase {
public FqNameUnsafe child(@NotNull Name name) {
String childFqName;
if (isRoot()) {
childFqName = name.getName();
childFqName = name.asString();
}
else {
childFqName = fqName + "." + name.getName();
childFqName = fqName + "." + name.asString();
}
return new FqNameUnsafe(childFqName, this, name);
}
@@ -210,7 +210,7 @@ public class FqNameUnsafe extends FqNameBase {
}
Name firstSegment = Name.guess(fqName.substring(0, pos));
FqNameUnsafe last = new FqNameUnsafe(firstSegment.getName(), FqName.ROOT.toUnsafe(), firstSegment);
FqNameUnsafe last = new FqNameUnsafe(firstSegment.asString(), FqName.ROOT.toUnsafe(), firstSegment);
callback.segment(firstSegment, last);
while (true) {
@@ -254,13 +254,13 @@ public class FqNameUnsafe extends FqNameBase {
@NotNull
public static FqNameUnsafe topLevel(@NotNull Name shortName) {
return new FqNameUnsafe(shortName.getName(), FqName.ROOT.toUnsafe(), shortName);
return new FqNameUnsafe(shortName.asString(), FqName.ROOT.toUnsafe(), shortName);
}
@Override
public String toString() {
return isRoot() ? ROOT_NAME.getName() : fqName;
return isRoot() ? ROOT_NAME.asString() : fqName;
}
@Override
@@ -29,7 +29,7 @@ public final class Name implements Comparable<Name> {
}
@NotNull
public String getName() {
public String asString() {
return name;
}
@@ -38,7 +38,7 @@ public final class Name implements Comparable<Name> {
if (special) {
throw new IllegalStateException("not identifier: " + this);
}
return getName();
return asString();
}
public boolean isSpecial() {
@@ -176,7 +176,7 @@ public class WritableScopeImpl extends WritableScopeWithImports {
checkMayWrite();
Map<LabelName, List<DeclarationDescriptor>> labelsToDescriptors = getLabelsToDescriptors();
LabelName name = new LabelName(descriptor.getName().getName());
LabelName name = new LabelName(descriptor.getName().asString());
List<DeclarationDescriptor> declarationDescriptors = labelsToDescriptors.get(name);
if (declarationDescriptors == null) {
declarationDescriptors = new ArrayList<DeclarationDescriptor>();
@@ -481,7 +481,7 @@ public class WritableScopeImpl extends WritableScopeWithImports {
public PropertyDescriptor getPropertyByFieldReference(@NotNull Name fieldName) {
checkMayRead();
if (!fieldName.getName().startsWith("$")) {
if (!fieldName.asString().startsWith("$")) {
throw new IllegalStateException();
}
@@ -792,13 +792,13 @@ public class BasicExpressionTypingVisitor extends ExpressionTypingVisitor {
if (operationType == JetTokens.PLUSPLUS || operationType == JetTokens.MINUSMINUS) {
assert returnType != null : "returnType is null for " + resolutionResults.getResultingDescriptor();
if (JetTypeChecker.INSTANCE.isSubtypeOf(returnType, KotlinBuiltIns.getInstance().getUnitType())) {
result = ErrorUtils.createErrorType(KotlinBuiltIns.getInstance().getUnit().getName().getName());
result = ErrorUtils.createErrorType(KotlinBuiltIns.getInstance().getUnit().getName().asString());
context.trace.report(INC_DEC_SHOULD_NOT_RETURN_UNIT.on(operationSign));
}
else {
JetType receiverType = receiver.getType();
if (!JetTypeChecker.INSTANCE.isSubtypeOf(returnType, receiverType)) {
context.trace.report(RESULT_TYPE_MISMATCH.on(operationSign, name.getName(), receiverType, returnType));
context.trace.report(RESULT_TYPE_MISMATCH.on(operationSign, name.asString(), receiverType, returnType));
}
else {
context.trace.record(BindingContext.VARIABLE_REASSIGNMENT, expression);
@@ -339,7 +339,7 @@ public class ControlStructureTypingVisitor extends ExpressionTypingVisitor {
VariableDescriptor olderVariable = context.scope.getLocalVariable(variableDescriptor.getName());
if (olderVariable != null && DescriptorUtils.isLocal(context.scope.getContainingDeclaration(), olderVariable)) {
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context.trace.getBindingContext(), variableDescriptor);
context.trace.report(Errors.NAME_SHADOWING.on(declaration, variableDescriptor.getName().getName()));
context.trace.report(Errors.NAME_SHADOWING.on(declaration, variableDescriptor.getName().asString()));
}
}
return variableDescriptor;
@@ -136,7 +136,7 @@ public class DelegatedPropertyUtils {
List<JetExpression> arguments = Lists.newArrayList();
arguments.add(createExpression(project, hasThis ? "this" : "null"));
arguments.add(createExpression(project, KotlinBuiltIns.getInstance().getPropertyMetadataImpl().getName().getName() + "(\"" + propertyDescriptor.getName().getName() + "\")"));
arguments.add(createExpression(project, KotlinBuiltIns.getInstance().getPropertyMetadataImpl().getName().asString() + "(\"" + propertyDescriptor.getName().asString() + "\")"));
if (!isGet) {
JetReferenceExpression fakeArgument = (JetReferenceExpression) createFakeExpressionOfType(context.expressionTypingServices.getProject(), trace,
@@ -148,7 +148,7 @@ public class DelegatedPropertyUtils {
}
Name functionName = Name.identifier(isGet ? "get" : "set");
JetReferenceExpression fakeCalleeExpression = createSimpleName(project, functionName.getName());
JetReferenceExpression fakeCalleeExpression = createSimpleName(project, functionName.asString());
ExpressionReceiver receiver = new ExpressionReceiver(delegateExpression, delegateType);
call = CallMaker.makeCallWithExpressions(fakeCalleeExpression, receiver, null, fakeCalleeExpression, arguments, Call.CallType.DEFAULT);
@@ -237,7 +237,7 @@ public class ExpressionTypingUtils {
@NotNull JetScope scope,
@NotNull ModuleDescriptor module
) {
JetImportDirective importDirective = JetPsiFactory.createImportDirective(project, callableFQN.getFqName());
JetImportDirective importDirective = JetPsiFactory.createImportDirective(project, callableFQN.asString());
Collection<? extends DeclarationDescriptor> declarationDescriptors = new QualifiedExpressionResolver()
.analyseImportReference(importDirective, scope, new BindingTraceContext(), module);
@@ -436,7 +436,7 @@ public class ExpressionTypingUtils {
if (oldDescriptor != null && DescriptorUtils.isLocal(variableDescriptor.getContainingDeclaration(), oldDescriptor)) {
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(context.trace.getBindingContext(), variableDescriptor);
if (declaration != null) {
context.trace.report(Errors.NAME_SHADOWING.on(declaration, variableDescriptor.getName().getName()));
context.trace.report(Errors.NAME_SHADOWING.on(declaration, variableDescriptor.getName().asString()));
}
}
}
@@ -263,9 +263,9 @@ public class KotlinBuiltIns {
}
private void makePrimitive(PrimitiveType primitiveType) {
ClassDescriptor theClass = getBuiltInClassByName(primitiveType.getTypeName().getName());
ClassDescriptor theClass = getBuiltInClassByName(primitiveType.getTypeName().asString());
JetType type = new JetTypeImpl(theClass);
ClassDescriptor arrayClass = getBuiltInClassByName(primitiveType.getArrayTypeName().getName());
ClassDescriptor arrayClass = getBuiltInClassByName(primitiveType.getArrayTypeName().asString());
JetType arrayType = new JetTypeImpl(arrayClass);
primitiveTypeToClass.put(primitiveType, theClass);
@@ -335,7 +335,7 @@ public class KotlinBuiltIns {
@NotNull
public ClassDescriptor getPrimitiveClassDescriptor(@NotNull PrimitiveType type) {
return getBuiltInClassByName(type.getTypeName().getName());
return getBuiltInClassByName(type.getTypeName().asString());
}
@NotNull
@@ -398,7 +398,7 @@ public class KotlinBuiltIns {
@NotNull
public ClassDescriptor getPrimitiveArrayClassDescriptor(@NotNull PrimitiveType type) {
return getBuiltInClassByName(type.getArrayTypeName().getName());
return getBuiltInClassByName(type.getArrayTypeName().asString());
}
@NotNull
@@ -39,8 +39,8 @@ public final class QualifiedNamesUtil {
return true;
}
String subpackageNameStr = subpackageName.getFqName();
String packageNameStr = packageName.getFqName();
String subpackageNameStr = subpackageName.asString();
String packageNameStr = packageName.asString();
return (subpackageNameStr.startsWith(packageNameStr) && subpackageNameStr.charAt(packageNameStr.length()) == '.');
}
@@ -54,7 +54,7 @@ public final class QualifiedNamesUtil {
}
public static boolean isOneSegmentFQN(@NotNull FqName fqn) {
return isOneSegmentFQN(fqn.getFqName());
return isOneSegmentFQN(fqn.asString());
}
@NotNull
@@ -74,7 +74,7 @@ public final class QualifiedNamesUtil {
return FqName.ROOT;
}
String fqNameStr = fqName.getFqName();
String fqNameStr = fqName.asString();
return new FqName(fqNameStr.substring(fqNameStr.indexOf('.'), fqNameStr.length()));
}
@@ -93,12 +93,12 @@ public final class QualifiedNamesUtil {
@NotNull
public static String tail(@NotNull FqName headFQN, @NotNull FqName fullFQN) {
if (!isSubpackageOf(fullFQN, headFQN) || headFQN.isRoot()) {
return fullFQN.getFqName();
return fullFQN.asString();
}
return fullFQN.equals(headFQN) ?
"" :
fullFQN.getFqName().substring(headFQN.getFqName().length() + 1); // (headFQN + '.').length
fullFQN.asString().substring(headFQN.asString().length() + 1); // (headFQN + '.').length
}
/**