Minor. Renamed method.

This commit is contained in:
Evgeny Gerashchenko
2013-12-04 17:46:58 +04:00
parent e175ebf60a
commit 3352d8a954
49 changed files with 80 additions and 83 deletions
@@ -109,7 +109,7 @@ public class RangeCodegenUtil {
// Must be a standard library class // Must be a standard library class
return null; return null;
} }
return map.get(DescriptorUtils.getFQName(declarationDescriptor).toSafe()); return map.get(DescriptorUtils.getFqName(declarationDescriptor).toSafe());
} }
public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) { public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {
@@ -16,7 +16,6 @@
package org.jetbrains.jet.codegen; package org.jetbrains.jet.codegen;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import org.jetbrains.asm4.MethodVisitor; import org.jetbrains.asm4.MethodVisitor;
@@ -136,6 +135,7 @@ public class SamWrapperCodegen extends ParentCodegenAwareImpl {
FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(JetPsiUtil.getFQName(containingFile)); FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(JetPsiUtil.getFQName(containingFile));
String packageInternalName = JvmClassName.byFqNameWithoutInnerClasses(packageClassFqName).getInternalName(); String packageInternalName = JvmClassName.byFqNameWithoutInnerClasses(packageClassFqName).getInternalName();
return packageInternalName + "$sam$" + samInterface.getName().asString() + "$" + return packageInternalName + "$sam$" + samInterface.getName().asString() + "$" +
Integer.toHexString(CodegenUtil.getPathHashCode(containingFile.getVirtualFile()) * 31 + DescriptorUtils.getFQName(samInterface).hashCode()); Integer.toHexString(CodegenUtil.getPathHashCode(containingFile.getVirtualFile()) * 31 + DescriptorUtils.getFqName(
samInterface).hashCode());
} }
} }
@@ -138,7 +138,7 @@ public class IntrinsicMethods {
declareIntrinsicProperty(Name.identifier("CharSequence"), Name.identifier("length"), new StringLength()); declareIntrinsicProperty(Name.identifier("CharSequence"), Name.identifier("length"), new StringLength());
declareIntrinsicProperty(Name.identifier("String"), Name.identifier("length"), new StringLength()); declareIntrinsicProperty(Name.identifier("String"), Name.identifier("length"), new StringLength());
registerStaticField(getFQName(KotlinBuiltIns.getInstance().getUnit()).toSafe(), Name.identifier("VALUE")); registerStaticField(getFqName(KotlinBuiltIns.getInstance().getUnit()).toSafe(), Name.identifier("VALUE"));
for (PrimitiveType type : PrimitiveType.NUMBER_TYPES) { for (PrimitiveType type : PrimitiveType.NUMBER_TYPES) {
FqName rangeClassFqName = RangeCodegenUtil.getRangeClassFqName(type); FqName rangeClassFqName = RangeCodegenUtil.getRangeClassFqName(type);
@@ -97,7 +97,7 @@ class IntrinsicsMap {
@Nullable @Nullable
public IntrinsicMethod getIntrinsic(@NotNull CallableMemberDescriptor descriptor) { public IntrinsicMethod getIntrinsic(@NotNull CallableMemberDescriptor descriptor) {
Key key = new Key( Key key = new Key(
DescriptorUtils.getFQName(descriptor.getContainingDeclaration()), DescriptorUtils.getFqName(descriptor.getContainingDeclaration()),
descriptor.getName(), descriptor.getName(),
valueParameterCountForKey(descriptor)); valueParameterCountForKey(descriptor));
return intrinsicsMap.get(key); return intrinsicsMap.get(key);
@@ -233,7 +233,7 @@ public class JetTypeMapper extends BindingTraceAware {
DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor(); DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor();
if (descriptor instanceof ClassDescriptor) { if (descriptor instanceof ClassDescriptor) {
FqNameUnsafe className = DescriptorUtils.getFQName(descriptor); FqNameUnsafe className = DescriptorUtils.getFqName(descriptor);
if (className.isSafe()) { if (className.isSafe()) {
known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), jetType.isNullable()); known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), jetType.isNullable());
} }
@@ -104,7 +104,7 @@ public final class AnalyzerWithCompilerReport {
if (!incompletes.isEmpty()) { if (!incompletes.isEmpty()) {
StringBuilder message = new StringBuilder("The following classes have incomplete hierarchies:\n"); StringBuilder message = new StringBuilder("The following classes have incomplete hierarchies:\n");
for (ClassDescriptor incomplete : incompletes) { for (ClassDescriptor incomplete : incompletes) {
String fqName = DescriptorUtils.getFQName(incomplete).asString(); String fqName = DescriptorUtils.getFqName(incomplete).asString();
message.append(" ").append(fqName).append("\n"); message.append(" ").append(fqName).append("\n");
} }
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR, message.toString(), CompilerMessageLocation.NO_LOCATION); messageCollectorWrapper.report(CompilerMessageSeverity.ERROR, message.toString(), CompilerMessageLocation.NO_LOCATION);
@@ -51,7 +51,7 @@ import org.jetbrains.jet.renderer.DescriptorRenderer;
import java.util.*; import java.util.*;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
import static org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage.*; import static org.jetbrains.jet.lang.resolve.java.resolver.TypeUsage.*;
import static org.jetbrains.jet.lang.types.Variance.INVARIANT; import static org.jetbrains.jet.lang.types.Variance.INVARIANT;
@@ -169,7 +169,7 @@ public class SignaturesPropagationData {
) { ) {
assert receiverType == null : "Parameters before propagation have receiver type," + assert receiverType == null : "Parameters before propagation have receiver type," +
" but propagation should be disabled for functions compiled from Kotlin in class: " + " but propagation should be disabled for functions compiled from Kotlin in class: " +
DescriptorUtils.getFQName(containingClass); DescriptorUtils.getFqName(containingClass);
JetType resultReceiverType = null; JetType resultReceiverType = null;
List<ValueParameterDescriptor> resultParameters = Lists.newArrayList(); List<ValueParameterDescriptor> resultParameters = Lists.newArrayList();
@@ -260,8 +260,8 @@ public class SignaturesPropagationData {
Collections.sort(superFunctions, new Comparator<FunctionDescriptor>() { Collections.sort(superFunctions, new Comparator<FunctionDescriptor>() {
@Override @Override
public int compare(FunctionDescriptor fun1, FunctionDescriptor fun2) { public int compare(FunctionDescriptor fun1, FunctionDescriptor fun2) {
FqNameUnsafe fqName1 = getFQName(fun1.getContainingDeclaration()); FqNameUnsafe fqName1 = getFqName(fun1.getContainingDeclaration());
FqNameUnsafe fqName2 = getFQName(fun2.getContainingDeclaration()); FqNameUnsafe fqName2 = getFqName(fun2.getContainingDeclaration());
return fqName1.asString().compareTo(fqName2.asString()); return fqName1.asString().compareTo(fqName2.asString());
} }
}); });
@@ -282,7 +282,7 @@ public class SignaturesPropagationData {
for (JetType supertype : TypeUtils.getAllSupertypes(containingClass.getDefaultType())) { for (JetType supertype : TypeUtils.getAllSupertypes(containingClass.getDefaultType())) {
ClassifierDescriptor klass = supertype.getConstructor().getDeclarationDescriptor(); ClassifierDescriptor klass = supertype.getConstructor().getDeclarationDescriptor();
assert klass != null; assert klass != null;
FqName fqName = DescriptorUtils.getFQName(klass).toSafe(); FqName fqName = DescriptorUtils.getFqName(klass).toSafe();
for (FunctionDescriptor fun : klass.getDefaultType().getMemberScope().getFunctions(functionName)) { for (FunctionDescriptor fun : klass.getDefaultType().getMemberScope().getFunctions(functionName)) {
CallableMemberDescriptor.Kind kind = fun.getKind(); CallableMemberDescriptor.Kind kind = fun.getKind();
@@ -98,7 +98,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
} }
private JetType visitCommonType(@NotNull ClassDescriptor classDescriptor, @NotNull JetTypeElement type) { private JetType visitCommonType(@NotNull ClassDescriptor classDescriptor, @NotNull JetTypeElement type) {
return visitCommonType(DescriptorUtils.getFQName(classDescriptor).toSafe().asString(), type); return visitCommonType(DescriptorUtils.getFqName(classDescriptor).toSafe().asString(), type);
} }
@NotNull @NotNull
@@ -109,7 +109,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
TypeConstructor originalTypeConstructor = originalType.getConstructor(); TypeConstructor originalTypeConstructor = originalType.getConstructor();
ClassifierDescriptor declarationDescriptor = originalTypeConstructor.getDeclarationDescriptor(); ClassifierDescriptor declarationDescriptor = originalTypeConstructor.getDeclarationDescriptor();
assert declarationDescriptor != null; assert declarationDescriptor != null;
FqName originalClassFqName = DescriptorUtils.getFQName(declarationDescriptor).toSafe(); FqName originalClassFqName = DescriptorUtils.getFqName(declarationDescriptor).toSafe();
ClassDescriptor classFromLibrary = getAutoTypeAnalogWithinBuiltins(originalClassFqName, qualifiedName); ClassDescriptor classFromLibrary = getAutoTypeAnalogWithinBuiltins(originalClassFqName, qualifiedName);
if (!isSameName(qualifiedName, originalClassFqName.asString()) && classFromLibrary == null) { if (!isSameName(qualifiedName, originalClassFqName.asString()) && classFromLibrary == null) {
throw new AlternativeSignatureMismatchException("Alternative signature type mismatch, expected: %s, actual: %s", throw new AlternativeSignatureMismatchException("Alternative signature type mismatch, expected: %s, actual: %s",
@@ -191,7 +191,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
if (altProjectionKind == parameter.getVariance()) { if (altProjectionKind == parameter.getVariance()) {
if (strictMode) { if (strictMode) {
throw new AlternativeSignatureMismatchException("Projection kind '%s' is redundant", throw new AlternativeSignatureMismatchException("Projection kind '%s' is redundant",
altProjectionKind, DescriptorUtils.getFQName(typeConstructor.getDeclarationDescriptor())); altProjectionKind, DescriptorUtils.getFqName(typeConstructor.getDeclarationDescriptor()));
} }
else { else {
altProjectionKind = projectionKind; altProjectionKind = projectionKind;
@@ -199,7 +199,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
} }
else { else {
throw new AlternativeSignatureMismatchException("Projection kind '%s' is conflicting with variance of %s", throw new AlternativeSignatureMismatchException("Projection kind '%s' is conflicting with variance of %s",
altProjectionKind, DescriptorUtils.getFQName(typeConstructor.getDeclarationDescriptor())); altProjectionKind, DescriptorUtils.getFqName(typeConstructor.getDeclarationDescriptor()));
} }
} }
} }
@@ -216,7 +216,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
Collection<ClassDescriptor> descriptors = JavaToKotlinClassMap.getInstance().mapPlatformClass(javaFqName); Collection<ClassDescriptor> descriptors = JavaToKotlinClassMap.getInstance().mapPlatformClass(javaFqName);
for (ClassDescriptor descriptor : descriptors) { for (ClassDescriptor descriptor : descriptors) {
String fqName = DescriptorUtils.getFQName(descriptor).asString(); String fqName = DescriptorUtils.getFqName(descriptor).asString();
if (isSameName(qualifiedName, fqName)) { if (isSameName(qualifiedName, fqName)) {
return descriptor; return descriptor;
} }
@@ -97,7 +97,7 @@ public class KotlinToJavaTypesMap extends JavaToKotlinClassMapBuilder {
@Override @Override
protected void register(@NotNull Class<?> javaClass, @NotNull ClassDescriptor kotlinDescriptor, @NotNull Direction direction) { protected void register(@NotNull Class<?> javaClass, @NotNull ClassDescriptor kotlinDescriptor, @NotNull Direction direction) {
if (direction == Direction.BOTH || direction == Direction.KOTLIN_TO_JAVA) { if (direction == Direction.BOTH || direction == Direction.KOTLIN_TO_JAVA) {
FqNameUnsafe fqNameUnsafe = DescriptorUtils.getFQName(kotlinDescriptor); FqNameUnsafe fqNameUnsafe = DescriptorUtils.getFqName(kotlinDescriptor);
assert fqNameUnsafe.isSafe() : "FQ name of a mapped class should be safe: " + fqNameUnsafe; assert fqNameUnsafe.isSafe() : "FQ name of a mapped class should be safe: " + fqNameUnsafe;
FqName fqName = fqNameUnsafe.toSafe(); FqName fqName = fqNameUnsafe.toSafe();
register(fqName, AsmTypeConstants.getType(javaClass)); register(fqName, AsmTypeConstants.getType(javaClass));
@@ -312,7 +312,7 @@ public class Renderers {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
int index = 0; int index = 0;
for (ClassDescriptor descriptor : descriptors) { for (ClassDescriptor descriptor : descriptors) {
sb.append(DescriptorUtils.getFQName(descriptor).asString()); sb.append(DescriptorUtils.getFqName(descriptor).asString());
index++; index++;
if (index <= descriptors.size() - 2) { if (index <= descriptors.size() - 2) {
sb.append(", "); sb.append(", ");
@@ -126,7 +126,7 @@ public class AnnotationUtils {
} }
public static boolean isJavaLangClass(ClassDescriptor descriptor) { public static boolean isJavaLangClass(ClassDescriptor descriptor) {
return "java.lang.Class".equals(DescriptorUtils.getFQName(descriptor).asString()); return "java.lang.Class".equals(DescriptorUtils.getFqName(descriptor).asString());
} }
private AnnotationUtils() { private AnnotationUtils() {
@@ -34,7 +34,7 @@ import java.util.Collection;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
public class OverloadResolver { public class OverloadResolver {
private TopDownAnalysisContext context; private TopDownAnalysisContext context;
@@ -83,7 +83,7 @@ public class OverloadResolver {
inClasses.put(classDescriptor, klass.getConstructors()); inClasses.put(classDescriptor, klass.getConstructors());
} }
else if (containingDeclaration instanceof PackageFragmentDescriptor) { else if (containingDeclaration instanceof PackageFragmentDescriptor) {
inPackages.put(getFQName(klass), klass.getConstructors()); inPackages.put(getFqName(klass), klass.getConstructors());
} }
else if (!(containingDeclaration instanceof FunctionDescriptor)) { else if (!(containingDeclaration instanceof FunctionDescriptor)) {
throw new IllegalStateException(); throw new IllegalStateException();
@@ -97,13 +97,13 @@ public class OverloadResolver {
for (SimpleFunctionDescriptor function : context.getFunctions().values()) { for (SimpleFunctionDescriptor function : context.getFunctions().values()) {
if (function.getContainingDeclaration() instanceof PackageFragmentDescriptor) { if (function.getContainingDeclaration() instanceof PackageFragmentDescriptor) {
functionsByName.putValue(getFQName(function), function); functionsByName.putValue(getFqName(function), function);
} }
} }
for (PropertyDescriptor property : context.getProperties().values()) { for (PropertyDescriptor property : context.getProperties().values()) {
if (property.getContainingDeclaration() instanceof PackageFragmentDescriptor) { if (property.getContainingDeclaration() instanceof PackageFragmentDescriptor) {
functionsByName.putValue(getFQName(property), property); functionsByName.putValue(getFqName(property), property);
} }
} }
@@ -402,7 +402,7 @@ public class QualifiedExpressionResolver {
} }
if (packageView != null && classDescriptor != null) { if (packageView != null && classDescriptor != null) {
if (DescriptorUtils.getFQName(packageView).equalsTo(DescriptorUtils.getFQName(classDescriptor))) { if (DescriptorUtils.getFqName(packageView).equalsTo(DescriptorUtils.getFqName(classDescriptor))) {
trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, classDescriptor); trace.record(BindingContext.REFERENCE_TARGET, referenceExpression, classDescriptor);
trace.record(BindingContext.RESOLUTION_SCOPE, referenceExpression, resolutionScope); trace.record(BindingContext.RESOLUTION_SCOPE, referenceExpression, resolutionScope);
checkVisibility(classDescriptor, trace, referenceExpression, scopeToCheckVisibility); checkVisibility(classDescriptor, trace, referenceExpression, scopeToCheckVisibility);
@@ -346,7 +346,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
new Function0<Collection<JetType>>() { new Function0<Collection<JetType>>() {
@Override @Override
public Collection<JetType> invoke() { public Collection<JetType> invoke() {
if (resolveSession.isClassSpecial(DescriptorUtils.getFQName(LazyClassDescriptor.this))) { if (resolveSession.isClassSpecial(DescriptorUtils.getFqName(LazyClassDescriptor.this))) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession; import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
import org.jetbrains.jet.lang.resolve.lazy.declarations.PackageMemberDeclarationProvider; import org.jetbrains.jet.lang.resolve.lazy.declarations.PackageMemberDeclarationProvider;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.JetScope;
@@ -48,7 +47,7 @@ public class LazyPackageMemberScope extends AbstractLazyMemberScope<PackageFragm
@Override @Override
public ClassifierDescriptor getClassifier(@NotNull Name name) { public ClassifierDescriptor getClassifier(@NotNull Name name) {
// TODO: creating an FqName every time may be a performance problem // TODO: creating an FqName every time may be a performance problem
Name actualName = resolveSession.resolveClassifierAlias(DescriptorUtils.getFQName(thisDescriptor).toSafe(), name); Name actualName = resolveSession.resolveClassifierAlias(DescriptorUtils.getFqName(thisDescriptor).toSafe(), name);
return super.getClassifier(actualName); return super.getClassifier(actualName);
} }
@@ -370,7 +370,7 @@ public class KotlinLightClassForExplicitDeclaration extends KotlinWrappingLightC
ClassDescriptor deprecatedAnnotation = KotlinBuiltIns.getInstance().getDeprecatedAnnotation(); ClassDescriptor deprecatedAnnotation = KotlinBuiltIns.getInstance().getDeprecatedAnnotation();
String deprecatedName = deprecatedAnnotation.getName().asString(); String deprecatedName = deprecatedAnnotation.getName().asString();
FqNameUnsafe deprecatedFqName = DescriptorUtils.getFQName(deprecatedAnnotation); FqNameUnsafe deprecatedFqName = DescriptorUtils.getFqName(deprecatedAnnotation);
for (JetAnnotationEntry annotationEntry : jetModifierList.getAnnotationEntries()) { for (JetAnnotationEntry annotationEntry : jetModifierList.getAnnotationEntries()) {
JetTypeReference typeReference = annotationEntry.getTypeReference(); JetTypeReference typeReference = annotationEntry.getTypeReference();
@@ -419,7 +419,7 @@ public class KotlinLightClassForExplicitDeclaration extends KotlinWrappingLightC
public boolean isInheritor(@NotNull PsiClass baseClass, boolean checkDeep) { public boolean isInheritor(@NotNull PsiClass baseClass, boolean checkDeep) {
String qualifiedName; String qualifiedName;
if (baseClass instanceof KotlinLightClassForExplicitDeclaration) { if (baseClass instanceof KotlinLightClassForExplicitDeclaration) {
qualifiedName = DescriptorUtils.getFQName(((KotlinLightClassForExplicitDeclaration) baseClass).getDescriptor()).asString(); qualifiedName = DescriptorUtils.getFqName(((KotlinLightClassForExplicitDeclaration) baseClass).getDescriptor()).asString();
} }
else { else {
qualifiedName = baseClass.getQualifiedName(); qualifiedName = baseClass.getQualifiedName();
@@ -58,7 +58,7 @@ public abstract class AbstractLoadCompiledKotlinTest extends TestCaseWithTmpdir
for (DeclarationDescriptor descriptor : packageFromBinary.getMemberScope().getAllDescriptors()) { for (DeclarationDescriptor descriptor : packageFromBinary.getMemberScope().getAllDescriptors()) {
if (descriptor instanceof ClassDescriptor) { if (descriptor instanceof ClassDescriptor) {
assert descriptor instanceof DeserializedClassDescriptor : DescriptorUtils.getFQName(descriptor) + " is loaded as " + descriptor.getClass(); assert descriptor instanceof DeserializedClassDescriptor : DescriptorUtils.getFqName(descriptor) + " is loaded as " + descriptor.getClass();
} }
} }
@@ -85,7 +85,7 @@ public class ExpectedLoadErrorsUtil {
ClassDescriptor annotationClass = (ClassDescriptor) annotation.getType().getConstructor().getDeclarationDescriptor(); ClassDescriptor annotationClass = (ClassDescriptor) annotation.getType().getConstructor().getDeclarationDescriptor();
assert annotationClass != null; assert annotationClass != null;
if (DescriptorUtils.getFQName(annotationClass).asString().equals(ANNOTATION_CLASS_NAME)) { if (DescriptorUtils.getFqName(annotationClass).asString().equals(ANNOTATION_CLASS_NAME)) {
// we expect exactly one annotation argument // we expect exactly one annotation argument
CompileTimeConstant<?> argument = annotation.getAllValueArguments().values().iterator().next(); CompileTimeConstant<?> argument = annotation.getAllValueArguments().values().iterator().next();
@@ -188,7 +188,7 @@ public class JdkAnnotationsValidityTest extends UsefulTestCase {
@Override @Override
public Void visitClassDescriptor(ClassDescriptor descriptor, Void data) { public Void visitClassDescriptor(ClassDescriptor descriptor, Void data) {
// skip java.util.Collection, etc. // skip java.util.Collection, etc.
if (!JavaToKotlinClassMap.getInstance().mapPlatformClass(DescriptorUtils.getFQName(descriptor).toSafe()).isEmpty()) { if (!JavaToKotlinClassMap.getInstance().mapPlatformClass(DescriptorUtils.getFqName(descriptor).toSafe()).isEmpty()) {
return null; return null;
} }
@@ -172,7 +172,7 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
@Override @Override
@NotNull @NotNull
public Collection<ClassDescriptor> mapPlatformClass(@NotNull ClassDescriptor classDescriptor) { public Collection<ClassDescriptor> mapPlatformClass(@NotNull ClassDescriptor classDescriptor) {
FqNameUnsafe className = DescriptorUtils.getFQName(classDescriptor); FqNameUnsafe className = DescriptorUtils.getFqName(classDescriptor);
if (!className.isSafe()) { if (!className.isSafe()) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -182,7 +182,7 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
@Override @Override
@NotNull @NotNull
public Collection<ClassDescriptor> mapPlatformClassesInside(@NotNull DeclarationDescriptor containingDeclaration) { public Collection<ClassDescriptor> mapPlatformClassesInside(@NotNull DeclarationDescriptor containingDeclaration) {
FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration); FqNameUnsafe fqName = DescriptorUtils.getFqName(containingDeclaration);
if (!fqName.isSafe()) { if (!fqName.isSafe()) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -38,7 +38,7 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
import java.util.*; import java.util.*;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isEnumClassObject; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.isEnumClassObject;
public final class DescriptorResolverUtils { public final class DescriptorResolverUtils {
@@ -338,7 +338,7 @@ public final class DescriptorResolverUtils {
"java class " + javaClass + " is under non-java fragment: " + packageFragment; "java class " + javaClass + " is under non-java fragment: " + packageFragment;
JavaPackageFragmentProvider provider = ((JavaPackageFragmentDescriptor) packageFragment).getProvider(); JavaPackageFragmentProvider provider = ((JavaPackageFragmentDescriptor) packageFragment).getProvider();
return provider.getOrCreatePackage(getFQName(javaClass).toSafe()); return provider.getOrCreatePackage(getFqName(javaClass).toSafe());
} }
public static boolean isJavaClassVisibleAsPackage(@NotNull JavaClass javaClass) { public static boolean isJavaClassVisibleAsPackage(@NotNull JavaClass javaClass) {
@@ -320,7 +320,7 @@ public final class JavaClassResolver {
FqName containerFqName = methodContainer.getFqName(); FqName containerFqName = methodContainer.getFqName();
assert containerFqName != null : "qualified name is null for " + methodContainer; assert containerFqName != null : "qualified name is null for " + methodContainer;
if (DescriptorUtils.getFQName(samInterface).equalsTo(containerFqName)) { if (DescriptorUtils.getFqName(samInterface).equalsTo(containerFqName)) {
SimpleFunctionDescriptor abstractMethod = functionResolver.resolveFunctionMutely(samInterfaceMethod, samInterface); SimpleFunctionDescriptor abstractMethod = functionResolver.resolveFunctionMutely(samInterfaceMethod, samInterface);
assert abstractMethod != null : "couldn't resolve method " + samInterfaceMethod; assert abstractMethod != null : "couldn't resolve method " + samInterfaceMethod;
return abstractMethod; return abstractMethod;
@@ -111,7 +111,7 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorNonRootImp
} }
private String nameForAssertions() { private String nameForAssertions() {
return getName() + " declared in " + DescriptorUtils.getFQName(getContainingDeclaration()); return getName() + " declared in " + DescriptorUtils.getFqName(getContainingDeclaration());
} }
public void setInitialized() { public void setInitialized() {
@@ -109,7 +109,7 @@ public class DescriptorUtils {
} }
@NotNull @NotNull
public static FqNameUnsafe getFQName(@NotNull DeclarationDescriptor descriptor) { public static FqNameUnsafe getFqName(@NotNull DeclarationDescriptor descriptor) {
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
if (descriptor instanceof ModuleDescriptor || ErrorUtils.isError(descriptor)) { if (descriptor instanceof ModuleDescriptor || ErrorUtils.isError(descriptor)) {
@@ -126,10 +126,10 @@ public class DescriptorUtils {
if (containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).getKind() == ClassKind.CLASS_OBJECT) { if (containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).getKind() == ClassKind.CLASS_OBJECT) {
DeclarationDescriptor classOfClassObject = containingDeclaration.getContainingDeclaration(); DeclarationDescriptor classOfClassObject = containingDeclaration.getContainingDeclaration();
assert classOfClassObject != null; assert classOfClassObject != null;
return getFQName(classOfClassObject).child(descriptor.getName()); return getFqName(classOfClassObject).child(descriptor.getName());
} }
return getFQName(containingDeclaration).child(descriptor.getName()); return getFqName(containingDeclaration).child(descriptor.getName());
} }
public static boolean isTopLevelDeclaration(@NotNull DeclarationDescriptor descriptor) { public static boolean isTopLevelDeclaration(@NotNull DeclarationDescriptor descriptor) {
@@ -21,7 +21,7 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
public fun ClassDescriptor.checkSuperTypeByFQName(qualifiedName: String, deep: Boolean): Boolean { public fun ClassDescriptor.checkSuperTypeByFQName(qualifiedName: String, deep: Boolean): Boolean {
fun checkDescriptor(descriptor: DeclarationDescriptor): Boolean { fun checkDescriptor(descriptor: DeclarationDescriptor): Boolean {
return qualifiedName == DescriptorUtils.getFQName(descriptor).asString() return qualifiedName == DescriptorUtils.getFqName(descriptor).asString()
} }
if (deep && checkDescriptor(this)) return true if (deep && checkDescriptor(this)) return true
@@ -30,8 +30,8 @@ public interface RedeclarationHandler {
@Override @Override
public void handleRedeclaration(@NotNull DeclarationDescriptor first, @NotNull DeclarationDescriptor second) { public void handleRedeclaration(@NotNull DeclarationDescriptor first, @NotNull DeclarationDescriptor second) {
throw new IllegalStateException( throw new IllegalStateException(
String.format("Redeclaration: %s (%s) and %s (%s) (no line info available)", DescriptorUtils.getFQName(first), first, String.format("Redeclaration: %s (%s) and %s (%s) (no line info available)", DescriptorUtils.getFqName(first), first,
DescriptorUtils.getFQName(second), second) DescriptorUtils.getFqName(second), second)
); );
} }
}; };
@@ -197,7 +197,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
Collections.reverse(qualifiedNameElements); Collections.reverse(qualifiedNameElements);
return renderFqName(qualifiedNameElements); return renderFqName(qualifiedNameElements);
} }
return renderFqName(DescriptorUtils.getFQName(klass)); return renderFqName(DescriptorUtils.getFqName(klass));
} }
/* TYPES RENDERING */ /* TYPES RENDERING */
@@ -299,7 +299,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
if (containingDeclaration != null) { if (containingDeclaration != null) {
FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration); FqNameUnsafe fqName = DescriptorUtils.getFqName(containingDeclaration);
builder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : renderFqName(fqName)); builder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : renderFqName(fqName));
} }
} }
@@ -310,7 +310,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
ClassDescriptor annotationClass = (ClassDescriptor) annotation.getType().getConstructor().getDeclarationDescriptor(); ClassDescriptor annotationClass = (ClassDescriptor) annotation.getType().getConstructor().getDeclarationDescriptor();
assert annotationClass != null; assert annotationClass != null;
if (!excludedAnnotationClasses.contains(DescriptorUtils.getFQName(annotationClass).toSafe())) { if (!excludedAnnotationClasses.contains(DescriptorUtils.getFqName(annotationClass).toSafe())) {
builder.append(renderType(annotation.getType())); builder.append(renderType(annotation.getType()));
if (verbose) { if (verbose) {
builder.append("(").append(StringUtil.join(DescriptorUtils.getSortedValueArguments(annotation, this), ", ")).append(")"); builder.append("(").append(StringUtil.join(DescriptorUtils.getSortedValueArguments(annotation, this), ", ")).append(")");
@@ -228,7 +228,7 @@ public class GenerateJavaToKotlinMethodMap {
private void appendBeforeClass(@NotNull ClassDescriptor kotlinClass, @NotNull PsiClass psiClass) { private void appendBeforeClass(@NotNull ClassDescriptor kotlinClass, @NotNull PsiClass psiClass) {
String psiFqName = psiClass.getQualifiedName(); String psiFqName = psiClass.getQualifiedName();
String kotlinFqName = DescriptorUtils.getFQName(kotlinClass).toSafe().asString(); String kotlinFqName = DescriptorUtils.getFqName(kotlinClass).toSafe().asString();
assert kotlinFqName.startsWith(BUILTINS_FQNAME_PREFIX); assert kotlinFqName.startsWith(BUILTINS_FQNAME_PREFIX);
String kotlinSubQualifiedName = kotlinFqName.substring(BUILTINS_FQNAME_PREFIX.length()); String kotlinSubQualifiedName = kotlinFqName.substring(BUILTINS_FQNAME_PREFIX.length());
@@ -71,7 +71,7 @@ public class ReferenceToClassesShortening {
compactReferenceToClass(userType, targetClass); compactReferenceToClass(userType, targetClass);
} }
else if (classifier == null) { else if (classifier == null) {
ImportInsertHelper.addImportDirectiveIfNeeded(DescriptorUtils.getFQName(targetTopLevelClass).toSafe(), file); ImportInsertHelper.addImportDirectiveIfNeeded(DescriptorUtils.getFqName(targetTopLevelClass).toSafe(), file);
compactReferenceToClass(userType, targetClass); compactReferenceToClass(userType, targetClass);
} }
else { else {
@@ -76,7 +76,7 @@ public final class DescriptorLookupConverter {
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
if (containingDeclaration != null && extensionFunction) { if (containingDeclaration != null && extensionFunction) {
tailText += " for " + DescriptorRenderer.TEXT.renderType(functionDescriptor.getReceiverParameter().getType()); tailText += " for " + DescriptorRenderer.TEXT.renderType(functionDescriptor.getReceiverParameter().getType());
tailText += " in " + DescriptorUtils.getFQName(containingDeclaration); tailText += " in " + DescriptorUtils.getFqName(containingDeclaration);
} }
} }
else if (descriptor instanceof VariableDescriptor) { else if (descriptor instanceof VariableDescriptor) {
@@ -86,7 +86,7 @@ public final class DescriptorLookupConverter {
else if (descriptor instanceof ClassDescriptor) { else if (descriptor instanceof ClassDescriptor) {
DeclarationDescriptor declaredIn = descriptor.getContainingDeclaration(); DeclarationDescriptor declaredIn = descriptor.getContainingDeclaration();
assert declaredIn != null; assert declaredIn != null;
tailText = " (" + DescriptorUtils.getFQName(declaredIn) + ")"; tailText = " (" + DescriptorUtils.getFqName(declaredIn) + ")";
tailTextGrayed = true; tailTextGrayed = true;
} }
else { else {
@@ -282,7 +282,7 @@ private fun staticMembers(context: JetExpression, expectedType: JetType, resolve
var builder = LookupElementBuilder.create(lookupElement.getObject(), classDescriptor.getName().asString() + "." + lookupElement.getLookupString()) var builder = LookupElementBuilder.create(lookupElement.getObject(), classDescriptor.getName().asString() + "." + lookupElement.getLookupString())
.withIcon(presentation.getIcon()) .withIcon(presentation.getIcon())
.withStrikeoutness(presentation.isStrikeout()) .withStrikeoutness(presentation.isStrikeout())
.withTailText(" (" + DescriptorUtils.getFQName(classDescriptor.getContainingDeclaration()) + ")") .withTailText(" (" + DescriptorUtils.getFqName(classDescriptor.getContainingDeclaration()) + ")")
.withTypeText(if (!presentation.getTypeText().isNullOrEmpty()) .withTypeText(if (!presentation.getTypeText().isNullOrEmpty())
presentation.getTypeText() presentation.getTypeText()
else else
@@ -54,7 +54,7 @@ public class JetClassInsertHandler implements InsertHandler<LookupElement> {
DeclarationDescriptor descriptor = lookupObject.getDescriptor(); DeclarationDescriptor descriptor = lookupObject.getDescriptor();
PsiElement targetElement = lookupObject.getPsiElement(); PsiElement targetElement = lookupObject.getPsiElement();
if (descriptor != null) { if (descriptor != null) {
FqName fqn = DescriptorUtils.getFQName(descriptor).toSafe(); FqName fqn = DescriptorUtils.getFqName(descriptor).toSafe();
// TODO: Find out the way for getting psi element for JS libs // TODO: Find out the way for getting psi element for JS libs
if (targetElement != null) { if (targetElement != null) {
@@ -177,7 +177,7 @@ public class JetFunctionInsertHandler(val caretPosition : CaretPosition, val bra
if (DescriptorUtils.isTopLevelDeclaration(functionDescriptor)) { if (DescriptorUtils.isTopLevelDeclaration(functionDescriptor)) {
ApplicationManager.getApplication()?.runWriteAction { ApplicationManager.getApplication()?.runWriteAction {
val fqn = DescriptorUtils.getFQName(functionDescriptor).toSafe() val fqn = DescriptorUtils.getFqName(functionDescriptor).toSafe()
ImportInsertHelper.addImportDirectiveIfNeeded(fqn, file) ImportInsertHelper.addImportDirectiveIfNeeded(fqn, file)
} }
} }
@@ -63,7 +63,7 @@ public class JetDeclarationRemotenessWeigher extends LookupElementWeigher {
DeclarationDescriptor descriptor = lookupObject.getDescriptor(); DeclarationDescriptor descriptor = lookupObject.getDescriptor();
if (descriptor != null) { if (descriptor != null) {
FqNameUnsafe fqName = DescriptorUtils.getFQName(descriptor); FqNameUnsafe fqName = DescriptorUtils.getFqName(descriptor);
// Invalid name can be met for class object descriptor: Test.MyTest.A.<no name provided>.testOther // Invalid name can be met for class object descriptor: Test.MyTest.A.<no name provided>.testOther
if (QualifiedNamesUtil.isValidJavaFqName(fqName.toString())) { if (QualifiedNamesUtil.isValidJavaFqName(fqName.toString())) {
ImportPath importPath = new ImportPath(fqName.toString()); ImportPath importPath = new ImportPath(fqName.toString());
@@ -36,7 +36,6 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe; import org.jetbrains.jet.lang.resolve.name.FqNameUnsafe;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache; import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache;
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
import org.jetbrains.jet.util.QualifiedNamesUtil; import org.jetbrains.jet.util.QualifiedNamesUtil;
import java.util.*; import java.util.*;
@@ -184,7 +183,7 @@ public class JetImportOptimizer implements ImportOptimizer {
private void addResolvedCallFqName(@Nullable ResolvedCall resolvedCall) { private void addResolvedCallFqName(@Nullable ResolvedCall resolvedCall) {
if (resolvedCall != null) { if (resolvedCall != null) {
CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor(); CallableDescriptor resultingDescriptor = resolvedCall.getResultingDescriptor();
FqNameUnsafe name = DescriptorUtils.getFQName(resultingDescriptor); FqNameUnsafe name = DescriptorUtils.getFqName(resultingDescriptor);
assert name.isSafe(): "FqName for resulting descriptor should be safe " + resultingDescriptor.getName(); assert name.isSafe(): "FqName for resulting descriptor should be safe " + resultingDescriptor.getName();
usedQualifiedNames.add(name.toSafe()); usedQualifiedNames.add(name.toSafe());
} }
@@ -247,7 +247,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
private static String getDescriptorString(@NotNull DeclarationDescriptor descriptor) { private static String getDescriptorString(@NotNull DeclarationDescriptor descriptor) {
if (descriptor instanceof ClassDescriptor) { if (descriptor instanceof ClassDescriptor) {
return DescriptorUtils.getFQName(descriptor).asString(); return DescriptorUtils.getFqName(descriptor).asString();
} }
else if (descriptor instanceof ConstructorDescriptor) { else if (descriptor instanceof ConstructorDescriptor) {
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
@@ -164,7 +164,7 @@ public class IdeRenderers {
stringBuilder.append(" <i>defined in</i> "); stringBuilder.append(" <i>defined in</i> ");
DeclarationDescriptor containingDeclaration = funDescriptor.getContainingDeclaration(); DeclarationDescriptor containingDeclaration = funDescriptor.getContainingDeclaration();
if (containingDeclaration != null) { if (containingDeclaration != null) {
FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration); FqNameUnsafe fqName = DescriptorUtils.getFqName(containingDeclaration);
stringBuilder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : fqName.asString()); stringBuilder.append(FqName.ROOT.equalsTo(fqName) ? "root package" : fqName.asString());
} }
stringBuilder.append("</li>"); stringBuilder.append("</li>");
@@ -31,7 +31,7 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
import java.util.Set; import java.util.Set;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
public final class DecompiledNavigationUtils { public final class DecompiledNavigationUtils {
@@ -65,7 +65,7 @@ public final class DecompiledNavigationUtils {
return jetDeclaration; return jetDeclaration;
} }
else { else {
LOG.warn("Could not find an element to navigate to for descriptor " + getFQName(effectiveReferencedDescriptor)); LOG.warn("Could not find an element to navigate to for descriptor " + getFqName(effectiveReferencedDescriptor));
} }
return null; return null;
} }
@@ -120,7 +120,7 @@ public final class DecompiledNavigationUtils {
if (classKind == ClassKind.CLASS_OBJECT || classKind == ClassKind.ENUM_ENTRY) { if (classKind == ClassKind.CLASS_OBJECT || classKind == ClassKind.ENUM_ENTRY) {
return getContainerFqName(containerDescriptor.getContainingDeclaration()); return getContainerFqName(containerDescriptor.getContainingDeclaration());
} }
return getFQName(containerDescriptor).toSafe(); return getFqName(containerDescriptor).toSafe();
} }
return null; return null;
} }
@@ -353,7 +353,7 @@ public class JetSourceNavigationHelper {
assert className != null : "Class from BuiltIns should have a name"; assert className != null : "Class from BuiltIns should have a name";
ClassDescriptor classDescriptor = KotlinBuiltIns.getInstance().getBuiltInClassByName(className); ClassDescriptor classDescriptor = KotlinBuiltIns.getInstance().getBuiltInClassByName(className);
FqNameUnsafe fqName = DescriptorUtils.getFQName(classDescriptor); FqNameUnsafe fqName = DescriptorUtils.getFqName(classDescriptor);
if (fqName.isSafe()) { if (fqName.isSafe()) {
FqName javaFqName = KotlinToJavaTypesMap.getInstance().getKotlinToJavaFqName(fqName.toSafe()); FqName javaFqName = KotlinToJavaTypesMap.getInstance().getKotlinToJavaFqName(fqName.toSafe());
if (javaFqName != null) { if (javaFqName != null) {
@@ -125,7 +125,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
@Override @Override
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) { public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
assert declarationDescriptor != null; assert declarationDescriptor != null;
return DescriptorUtils.getFQName(declarationDescriptor).toSafe(); return DescriptorUtils.getFqName(declarationDescriptor).toSafe();
} }
})); }));
} }
@@ -152,7 +152,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
@Override @Override
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) { public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
assert declarationDescriptor != null; assert declarationDescriptor != null;
return DescriptorUtils.getFQName(declarationDescriptor).toSafe(); return DescriptorUtils.getFqName(declarationDescriptor).toSafe();
} }
})); }));
} }
@@ -219,7 +219,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
return Collections2.transform(descriptors, new Function<ClassDescriptor, FqName>() { return Collections2.transform(descriptors, new Function<ClassDescriptor, FqName>() {
@Override @Override
public FqName apply(ClassDescriptor descriptor) { public FqName apply(ClassDescriptor descriptor) {
return DescriptorUtils.getFQName(descriptor).toSafe(); return DescriptorUtils.getFqName(descriptor).toSafe();
} }
}); });
} }
@@ -57,7 +57,6 @@ import org.jetbrains.jet.lang.psi.*;
import org.jetbrains.jet.lang.resolve.BindingContext; import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.BindingContextUtils; import org.jetbrains.jet.lang.resolve.BindingContextUtils;
import org.jetbrains.jet.lang.resolve.DescriptorUtils; import org.jetbrains.jet.lang.resolve.DescriptorUtils;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.name.Name; import org.jetbrains.jet.lang.resolve.name.Name;
import org.jetbrains.jet.lang.resolve.scopes.JetScope; import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.*; import org.jetbrains.jet.lang.types.*;
@@ -902,7 +901,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
assert returnTypeRef != null; assert returnTypeRef != null;
properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, returnTypeRef.getText()); properties.setProperty(FileTemplate.ATTRIBUTE_RETURN_TYPE, returnTypeRef.getText());
} }
properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, DescriptorUtils.getFQName(ownerClassDescriptor).asString()); properties.setProperty(FileTemplate.ATTRIBUTE_CLASS_NAME, DescriptorUtils.getFqName(ownerClassDescriptor).asString());
properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, ownerClassDescriptor.getName().asString()); properties.setProperty(FileTemplate.ATTRIBUTE_SIMPLE_CLASS_NAME, ownerClassDescriptor.getName().asString());
properties.setProperty(ATTRIBUTE_FUNCTION_NAME, functionName); properties.setProperty(ATTRIBUTE_FUNCTION_NAME, functionName);
@@ -1060,7 +1059,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
String replacement = typeParameterNameMap.get(declarationDescriptor); String replacement = typeParameterNameMap.get(declarationDescriptor);
return replacement == null ? declarationDescriptor.getName().asString() : replacement; return replacement == null ? declarationDescriptor.getName().asString() : replacement;
} else { } else {
return fq ? DescriptorUtils.getFQName(declarationDescriptor).asString() : declarationDescriptor.getName().asString(); return fq ? DescriptorUtils.getFqName(declarationDescriptor).asString() : declarationDescriptor.getName().asString();
} }
} }
@@ -138,7 +138,7 @@ public class BuiltInsReferenceResolver extends AbstractProjectComponent {
return ((ClassDescriptor) currentParent).getClassObjectDescriptor(); return ((ClassDescriptor) currentParent).getClassObjectDescriptor();
} }
else { else {
return bindingContext.get(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, DescriptorUtils.getFQName(originalDescriptor).toSafe()); return bindingContext.get(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, DescriptorUtils.getFqName(originalDescriptor).toSafe());
} }
} }
@@ -78,7 +78,7 @@ public class KotlinAnnotatedElementsSearcher extends AnnotatedElementsSearcher {
ClassifierDescriptor descriptor = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor(); ClassifierDescriptor descriptor = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
if (descriptor == null) return; if (descriptor == null) return;
if (!(DescriptorUtils.getFQName(descriptor).asString().equals(annotationFQN))) return; if (!(DescriptorUtils.getFqName(descriptor).asString().equals(annotationFQN))) return;
if (parentOfType instanceof JetClass) { if (parentOfType instanceof JetClass) {
PsiClass lightClass = LightClassUtil.getPsiClass((JetClass) parentOfType); PsiClass lightClass = LightClassUtil.getPsiClass((JetClass) parentOfType);
@@ -225,7 +225,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
textBuilder = new StringBuilder(descriptor.getName().asString()); textBuilder = new StringBuilder(descriptor.getName().asString());
textBuilder textBuilder
.append(" (") .append(" (")
.append(DescriptorUtils.getFQName(descriptor.getContainingDeclaration())) .append(DescriptorUtils.getFqName(descriptor.getContainingDeclaration()))
.append(")"); .append(")");
} }
else { else {
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lang.resolve.name.Name;
import java.util.Map; import java.util.Map;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
/** /**
* Provides a mechanism to bind some of the kotlin/java declations with library implementations. * Provides a mechanism to bind some of the kotlin/java declations with library implementations.
@@ -153,12 +153,12 @@ public final class StandardClasses {
} }
public boolean isStandardObject(@NotNull DeclarationDescriptor descriptor) { public boolean isStandardObject(@NotNull DeclarationDescriptor descriptor) {
return standardObjects.containsKey(getFQName(descriptor)); return standardObjects.containsKey(getFqName(descriptor));
} }
@NotNull @NotNull
public JsName getStandardObjectName(@NotNull DeclarationDescriptor descriptor) { public JsName getStandardObjectName(@NotNull DeclarationDescriptor descriptor) {
return standardObjects.get(getFQName(descriptor)); return standardObjects.get(getFqName(descriptor));
} }
@NotNull @NotNull
@@ -94,7 +94,7 @@ public final class PatternBuilder {
} }
private boolean doApply(@NotNull FunctionDescriptor descriptor) { private boolean doApply(@NotNull FunctionDescriptor descriptor) {
List<Name> nameParts = DescriptorUtils.getFQName(descriptor).pathSegments(); List<Name> nameParts = DescriptorUtils.getFqName(descriptor).pathSegments();
if (nameParts.size() != checkersWithPrefixChecker.size()) { if (nameParts.size() != checkersWithPrefixChecker.size()) {
return false; return false;
} }
@@ -98,7 +98,7 @@ public final class AnnotationsUtils {
DeclarationDescriptor annotationDeclaration = DeclarationDescriptor annotationDeclaration =
annotationDescriptor.getType().getConstructor().getDeclarationDescriptor(); annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
assert annotationDeclaration != null : "Annotation supposed to have a declaration"; assert annotationDeclaration != null : "Annotation supposed to have a declaration";
return DescriptorUtils.getFQName(annotationDeclaration).asString(); return DescriptorUtils.getFqName(annotationDeclaration).asString();
} }
public static boolean isNativeObject(@NotNull DeclarationDescriptor descriptor) { public static boolean isNativeObject(@NotNull DeclarationDescriptor descriptor) {
@@ -36,12 +36,12 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.*; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.*;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
public final class JsDescriptorUtils { public final class JsDescriptorUtils {
// TODO: maybe we should use external annotations or something else. // TODO: maybe we should use external annotations or something else.
private static final Set<String> FAKE_CLASSES = ContainerUtil.immutableSet( private static final Set<String> FAKE_CLASSES = ContainerUtil.immutableSet(
getFQName(KotlinBuiltIns.getInstance().getAny()).toSafe().asString(), getFqName(KotlinBuiltIns.getInstance().getAny()).toSafe().asString(),
"jet.Iterable" "jet.Iterable"
); );
@@ -82,7 +82,7 @@ public final class JsDescriptorUtils {
@Override @Override
public boolean value(JetType type) { public boolean value(JetType type) {
ClassDescriptor classDescriptor = getClassDescriptorForType(type); ClassDescriptor classDescriptor = getClassDescriptorForType(type);
return !FAKE_CLASSES.contains(getFQName(classDescriptor).toSafe().asString()); return !FAKE_CLASSES.contains(getFqName(classDescriptor).toSafe().asString());
} }
}); });
} }
@@ -34,7 +34,7 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import static com.google.dart.compiler.backend.js.ast.JsBinaryOperator.*; import static com.google.dart.compiler.backend.js.ast.JsBinaryOperator.*;
import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFQName; import static org.jetbrains.jet.lang.resolve.DescriptorUtils.getFqName;
import static org.jetbrains.k2js.translate.context.Namer.getKotlinBackingFieldName; import static org.jetbrains.k2js.translate.context.Namer.getKotlinBackingFieldName;
import static org.jetbrains.k2js.translate.utils.BindingUtils.getFunctionDescriptorForOperationExpression; import static org.jetbrains.k2js.translate.utils.BindingUtils.getFunctionDescriptorForOperationExpression;
import static org.jetbrains.k2js.translate.utils.JsAstUtils.assignment; import static org.jetbrains.k2js.translate.utils.JsAstUtils.assignment;
@@ -133,7 +133,7 @@ public final class TranslationUtils {
@NotNull @NotNull
public static String getMangledName(@NotNull PropertyDescriptor descriptor, @NotNull String suggestedName) { public static String getMangledName(@NotNull PropertyDescriptor descriptor, @NotNull String suggestedName) {
int absHashCode = Math.abs(getFQName(descriptor).asString().hashCode()); int absHashCode = Math.abs(getFqName(descriptor).asString().hashCode());
return suggestedName + "_" + Integer.toString(absHashCode, Character.MAX_RADIX) + "$"; return suggestedName + "_" + Integer.toString(absHashCode, Character.MAX_RADIX) + "$";
} }