Minor. Renamed method.
This commit is contained in:
@@ -109,7 +109,7 @@ public class RangeCodegenUtil {
|
||||
// Must be a standard library class
|
||||
return null;
|
||||
}
|
||||
return map.get(DescriptorUtils.getFQName(declarationDescriptor).toSafe());
|
||||
return map.get(DescriptorUtils.getFqName(declarationDescriptor).toSafe());
|
||||
}
|
||||
|
||||
public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package org.jetbrains.jet.codegen;
|
||||
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.MethodVisitor;
|
||||
@@ -136,6 +135,7 @@ public class SamWrapperCodegen extends ParentCodegenAwareImpl {
|
||||
FqName packageClassFqName = PackageClassUtils.getPackageClassFqName(JetPsiUtil.getFQName(containingFile));
|
||||
String packageInternalName = JvmClassName.byFqNameWithoutInnerClasses(packageClassFqName).getInternalName();
|
||||
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("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) {
|
||||
FqName rangeClassFqName = RangeCodegenUtil.getRangeClassFqName(type);
|
||||
|
||||
@@ -97,7 +97,7 @@ class IntrinsicsMap {
|
||||
@Nullable
|
||||
public IntrinsicMethod getIntrinsic(@NotNull CallableMemberDescriptor descriptor) {
|
||||
Key key = new Key(
|
||||
DescriptorUtils.getFQName(descriptor.getContainingDeclaration()),
|
||||
DescriptorUtils.getFqName(descriptor.getContainingDeclaration()),
|
||||
descriptor.getName(),
|
||||
valueParameterCountForKey(descriptor));
|
||||
return intrinsicsMap.get(key);
|
||||
|
||||
@@ -233,7 +233,7 @@ public class JetTypeMapper extends BindingTraceAware {
|
||||
DeclarationDescriptor descriptor = jetType.getConstructor().getDeclarationDescriptor();
|
||||
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
FqNameUnsafe className = DescriptorUtils.getFQName(descriptor);
|
||||
FqNameUnsafe className = DescriptorUtils.getFqName(descriptor);
|
||||
if (className.isSafe()) {
|
||||
known = KotlinToJavaTypesMap.getInstance().getJavaAnalog(className.toSafe(), jetType.isNullable());
|
||||
}
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public final class AnalyzerWithCompilerReport {
|
||||
if (!incompletes.isEmpty()) {
|
||||
StringBuilder message = new StringBuilder("The following classes have incomplete hierarchies:\n");
|
||||
for (ClassDescriptor incomplete : incompletes) {
|
||||
String fqName = DescriptorUtils.getFQName(incomplete).asString();
|
||||
String fqName = DescriptorUtils.getFqName(incomplete).asString();
|
||||
message.append(" ").append(fqName).append("\n");
|
||||
}
|
||||
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR, message.toString(), CompilerMessageLocation.NO_LOCATION);
|
||||
|
||||
+5
-5
@@ -51,7 +51,7 @@ import org.jetbrains.jet.renderer.DescriptorRenderer;
|
||||
|
||||
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.types.Variance.INVARIANT;
|
||||
|
||||
@@ -169,7 +169,7 @@ public class SignaturesPropagationData {
|
||||
) {
|
||||
assert receiverType == null : "Parameters before propagation have receiver type," +
|
||||
" but propagation should be disabled for functions compiled from Kotlin in class: " +
|
||||
DescriptorUtils.getFQName(containingClass);
|
||||
DescriptorUtils.getFqName(containingClass);
|
||||
|
||||
JetType resultReceiverType = null;
|
||||
List<ValueParameterDescriptor> resultParameters = Lists.newArrayList();
|
||||
@@ -260,8 +260,8 @@ public class SignaturesPropagationData {
|
||||
Collections.sort(superFunctions, new Comparator<FunctionDescriptor>() {
|
||||
@Override
|
||||
public int compare(FunctionDescriptor fun1, FunctionDescriptor fun2) {
|
||||
FqNameUnsafe fqName1 = getFQName(fun1.getContainingDeclaration());
|
||||
FqNameUnsafe fqName2 = getFQName(fun2.getContainingDeclaration());
|
||||
FqNameUnsafe fqName1 = getFqName(fun1.getContainingDeclaration());
|
||||
FqNameUnsafe fqName2 = getFqName(fun2.getContainingDeclaration());
|
||||
return fqName1.asString().compareTo(fqName2.asString());
|
||||
}
|
||||
});
|
||||
@@ -282,7 +282,7 @@ public class SignaturesPropagationData {
|
||||
for (JetType supertype : TypeUtils.getAllSupertypes(containingClass.getDefaultType())) {
|
||||
ClassifierDescriptor klass = supertype.getConstructor().getDeclarationDescriptor();
|
||||
assert klass != null;
|
||||
FqName fqName = DescriptorUtils.getFQName(klass).toSafe();
|
||||
FqName fqName = DescriptorUtils.getFqName(klass).toSafe();
|
||||
|
||||
for (FunctionDescriptor fun : klass.getDefaultType().getMemberScope().getFunctions(functionName)) {
|
||||
CallableMemberDescriptor.Kind kind = fun.getKind();
|
||||
|
||||
+5
-5
@@ -98,7 +98,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
}
|
||||
|
||||
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
|
||||
@@ -109,7 +109,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
TypeConstructor originalTypeConstructor = originalType.getConstructor();
|
||||
ClassifierDescriptor declarationDescriptor = originalTypeConstructor.getDeclarationDescriptor();
|
||||
assert declarationDescriptor != null;
|
||||
FqName originalClassFqName = DescriptorUtils.getFQName(declarationDescriptor).toSafe();
|
||||
FqName originalClassFqName = DescriptorUtils.getFqName(declarationDescriptor).toSafe();
|
||||
ClassDescriptor classFromLibrary = getAutoTypeAnalogWithinBuiltins(originalClassFqName, qualifiedName);
|
||||
if (!isSameName(qualifiedName, originalClassFqName.asString()) && classFromLibrary == null) {
|
||||
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 (strictMode) {
|
||||
throw new AlternativeSignatureMismatchException("Projection kind '%s' is redundant",
|
||||
altProjectionKind, DescriptorUtils.getFQName(typeConstructor.getDeclarationDescriptor()));
|
||||
altProjectionKind, DescriptorUtils.getFqName(typeConstructor.getDeclarationDescriptor()));
|
||||
}
|
||||
else {
|
||||
altProjectionKind = projectionKind;
|
||||
@@ -199,7 +199,7 @@ public class TypeTransformingVisitor extends JetVisitor<JetType, Void> {
|
||||
}
|
||||
else {
|
||||
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);
|
||||
for (ClassDescriptor descriptor : descriptors) {
|
||||
String fqName = DescriptorUtils.getFQName(descriptor).asString();
|
||||
String fqName = DescriptorUtils.getFqName(descriptor).asString();
|
||||
if (isSameName(qualifiedName, fqName)) {
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
+1
-1
@@ -97,7 +97,7 @@ public class KotlinToJavaTypesMap extends JavaToKotlinClassMapBuilder {
|
||||
@Override
|
||||
protected void register(@NotNull Class<?> javaClass, @NotNull ClassDescriptor kotlinDescriptor, @NotNull Direction direction) {
|
||||
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;
|
||||
FqName fqName = fqNameUnsafe.toSafe();
|
||||
register(fqName, AsmTypeConstants.getType(javaClass));
|
||||
|
||||
@@ -312,7 +312,7 @@ public class Renderers {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int index = 0;
|
||||
for (ClassDescriptor descriptor : descriptors) {
|
||||
sb.append(DescriptorUtils.getFQName(descriptor).asString());
|
||||
sb.append(DescriptorUtils.getFqName(descriptor).asString());
|
||||
index++;
|
||||
if (index <= descriptors.size() - 2) {
|
||||
sb.append(", ");
|
||||
|
||||
@@ -126,7 +126,7 @@ public class AnnotationUtils {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Collection;
|
||||
import java.util.Map;
|
||||
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 {
|
||||
private TopDownAnalysisContext context;
|
||||
@@ -83,7 +83,7 @@ public class OverloadResolver {
|
||||
inClasses.put(classDescriptor, klass.getConstructors());
|
||||
}
|
||||
else if (containingDeclaration instanceof PackageFragmentDescriptor) {
|
||||
inPackages.put(getFQName(klass), klass.getConstructors());
|
||||
inPackages.put(getFqName(klass), klass.getConstructors());
|
||||
}
|
||||
else if (!(containingDeclaration instanceof FunctionDescriptor)) {
|
||||
throw new IllegalStateException();
|
||||
@@ -97,13 +97,13 @@ public class OverloadResolver {
|
||||
|
||||
for (SimpleFunctionDescriptor function : context.getFunctions().values()) {
|
||||
if (function.getContainingDeclaration() instanceof PackageFragmentDescriptor) {
|
||||
functionsByName.putValue(getFQName(function), function);
|
||||
functionsByName.putValue(getFqName(function), function);
|
||||
}
|
||||
}
|
||||
|
||||
for (PropertyDescriptor property : context.getProperties().values()) {
|
||||
if (property.getContainingDeclaration() instanceof PackageFragmentDescriptor) {
|
||||
functionsByName.putValue(getFQName(property), property);
|
||||
functionsByName.putValue(getFqName(property), property);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ public class QualifiedExpressionResolver {
|
||||
}
|
||||
|
||||
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.RESOLUTION_SCOPE, referenceExpression, resolutionScope);
|
||||
checkVisibility(classDescriptor, trace, referenceExpression, scopeToCheckVisibility);
|
||||
|
||||
+1
-1
@@ -346,7 +346,7 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
||||
new Function0<Collection<JetType>>() {
|
||||
@Override
|
||||
public Collection<JetType> invoke() {
|
||||
if (resolveSession.isClassSpecial(DescriptorUtils.getFQName(LazyClassDescriptor.this))) {
|
||||
if (resolveSession.isClassSpecial(DescriptorUtils.getFqName(LazyClassDescriptor.this))) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -24,7 +24,6 @@ import org.jetbrains.jet.lang.psi.JetFile;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lang.resolve.lazy.ResolveSession;
|
||||
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.scopes.JetScope;
|
||||
|
||||
@@ -48,7 +47,7 @@ public class LazyPackageMemberScope extends AbstractLazyMemberScope<PackageFragm
|
||||
@Override
|
||||
public ClassifierDescriptor getClassifier(@NotNull Name name) {
|
||||
// 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);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -370,7 +370,7 @@ public class KotlinLightClassForExplicitDeclaration extends KotlinWrappingLightC
|
||||
|
||||
ClassDescriptor deprecatedAnnotation = KotlinBuiltIns.getInstance().getDeprecatedAnnotation();
|
||||
String deprecatedName = deprecatedAnnotation.getName().asString();
|
||||
FqNameUnsafe deprecatedFqName = DescriptorUtils.getFQName(deprecatedAnnotation);
|
||||
FqNameUnsafe deprecatedFqName = DescriptorUtils.getFqName(deprecatedAnnotation);
|
||||
|
||||
for (JetAnnotationEntry annotationEntry : jetModifierList.getAnnotationEntries()) {
|
||||
JetTypeReference typeReference = annotationEntry.getTypeReference();
|
||||
@@ -419,7 +419,7 @@ public class KotlinLightClassForExplicitDeclaration extends KotlinWrappingLightC
|
||||
public boolean isInheritor(@NotNull PsiClass baseClass, boolean checkDeep) {
|
||||
String qualifiedName;
|
||||
if (baseClass instanceof KotlinLightClassForExplicitDeclaration) {
|
||||
qualifiedName = DescriptorUtils.getFQName(((KotlinLightClassForExplicitDeclaration) baseClass).getDescriptor()).asString();
|
||||
qualifiedName = DescriptorUtils.getFqName(((KotlinLightClassForExplicitDeclaration) baseClass).getDescriptor()).asString();
|
||||
}
|
||||
else {
|
||||
qualifiedName = baseClass.getQualifiedName();
|
||||
|
||||
@@ -58,7 +58,7 @@ public abstract class AbstractLoadCompiledKotlinTest extends TestCaseWithTmpdir
|
||||
|
||||
for (DeclarationDescriptor descriptor : packageFromBinary.getMemberScope().getAllDescriptors()) {
|
||||
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();
|
||||
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
|
||||
CompileTimeConstant<?> argument = annotation.getAllValueArguments().values().iterator().next();
|
||||
|
||||
@@ -188,7 +188,7 @@ public class JdkAnnotationsValidityTest extends UsefulTestCase {
|
||||
@Override
|
||||
public Void visitClassDescriptor(ClassDescriptor descriptor, Void data) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -172,7 +172,7 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<ClassDescriptor> mapPlatformClass(@NotNull ClassDescriptor classDescriptor) {
|
||||
FqNameUnsafe className = DescriptorUtils.getFQName(classDescriptor);
|
||||
FqNameUnsafe className = DescriptorUtils.getFqName(classDescriptor);
|
||||
if (!className.isSafe()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
@@ -182,7 +182,7 @@ public class JavaToKotlinClassMap extends JavaToKotlinClassMapBuilder implements
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<ClassDescriptor> mapPlatformClassesInside(@NotNull DeclarationDescriptor containingDeclaration) {
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration);
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFqName(containingDeclaration);
|
||||
if (!fqName.isSafe()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
+2
-2
@@ -38,7 +38,7 @@ import org.jetbrains.jet.lang.types.TypeSubstitutor;
|
||||
|
||||
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;
|
||||
|
||||
public final class DescriptorResolverUtils {
|
||||
@@ -338,7 +338,7 @@ public final class DescriptorResolverUtils {
|
||||
"java class " + javaClass + " is under non-java fragment: " + packageFragment;
|
||||
|
||||
JavaPackageFragmentProvider provider = ((JavaPackageFragmentDescriptor) packageFragment).getProvider();
|
||||
return provider.getOrCreatePackage(getFQName(javaClass).toSafe());
|
||||
return provider.getOrCreatePackage(getFqName(javaClass).toSafe());
|
||||
}
|
||||
|
||||
public static boolean isJavaClassVisibleAsPackage(@NotNull JavaClass javaClass) {
|
||||
|
||||
+1
-1
@@ -320,7 +320,7 @@ public final class JavaClassResolver {
|
||||
FqName containerFqName = methodContainer.getFqName();
|
||||
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);
|
||||
assert abstractMethod != null : "couldn't resolve method " + samInterfaceMethod;
|
||||
return abstractMethod;
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ public class TypeParameterDescriptorImpl extends DeclarationDescriptorNonRootImp
|
||||
}
|
||||
|
||||
private String nameForAssertions() {
|
||||
return getName() + " declared in " + DescriptorUtils.getFQName(getContainingDeclaration());
|
||||
return getName() + " declared in " + DescriptorUtils.getFqName(getContainingDeclaration());
|
||||
}
|
||||
|
||||
public void setInitialized() {
|
||||
|
||||
@@ -109,7 +109,7 @@ public class DescriptorUtils {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static FqNameUnsafe getFQName(@NotNull DeclarationDescriptor descriptor) {
|
||||
public static FqNameUnsafe getFqName(@NotNull DeclarationDescriptor descriptor) {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
|
||||
if (descriptor instanceof ModuleDescriptor || ErrorUtils.isError(descriptor)) {
|
||||
@@ -126,10 +126,10 @@ public class DescriptorUtils {
|
||||
if (containingDeclaration instanceof ClassDescriptor && ((ClassDescriptor) containingDeclaration).getKind() == ClassKind.CLASS_OBJECT) {
|
||||
DeclarationDescriptor classOfClassObject = containingDeclaration.getContainingDeclaration();
|
||||
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) {
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor
|
||||
|
||||
public fun ClassDescriptor.checkSuperTypeByFQName(qualifiedName: String, deep: Boolean): Boolean {
|
||||
fun checkDescriptor(descriptor: DeclarationDescriptor): Boolean {
|
||||
return qualifiedName == DescriptorUtils.getFQName(descriptor).asString()
|
||||
return qualifiedName == DescriptorUtils.getFqName(descriptor).asString()
|
||||
}
|
||||
|
||||
if (deep && checkDescriptor(this)) return true
|
||||
|
||||
+2
-2
@@ -30,8 +30,8 @@ public interface RedeclarationHandler {
|
||||
@Override
|
||||
public void handleRedeclaration(@NotNull DeclarationDescriptor first, @NotNull DeclarationDescriptor second) {
|
||||
throw new IllegalStateException(
|
||||
String.format("Redeclaration: %s (%s) and %s (%s) (no line info available)", DescriptorUtils.getFQName(first), first,
|
||||
DescriptorUtils.getFQName(second), second)
|
||||
String.format("Redeclaration: %s (%s) and %s (%s) (no line info available)", DescriptorUtils.getFqName(first), first,
|
||||
DescriptorUtils.getFqName(second), second)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -197,7 +197,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
Collections.reverse(qualifiedNameElements);
|
||||
return renderFqName(qualifiedNameElements);
|
||||
}
|
||||
return renderFqName(DescriptorUtils.getFQName(klass));
|
||||
return renderFqName(DescriptorUtils.getFqName(klass));
|
||||
}
|
||||
|
||||
/* TYPES RENDERING */
|
||||
@@ -299,7 +299,7 @@ public class DescriptorRendererImpl implements DescriptorRenderer {
|
||||
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
if (containingDeclaration != null) {
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFQName(containingDeclaration);
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFqName(containingDeclaration);
|
||||
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();
|
||||
assert annotationClass != null;
|
||||
|
||||
if (!excludedAnnotationClasses.contains(DescriptorUtils.getFQName(annotationClass).toSafe())) {
|
||||
if (!excludedAnnotationClasses.contains(DescriptorUtils.getFqName(annotationClass).toSafe())) {
|
||||
builder.append(renderType(annotation.getType()));
|
||||
if (verbose) {
|
||||
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) {
|
||||
String psiFqName = psiClass.getQualifiedName();
|
||||
String kotlinFqName = DescriptorUtils.getFQName(kotlinClass).toSafe().asString();
|
||||
String kotlinFqName = DescriptorUtils.getFqName(kotlinClass).toSafe().asString();
|
||||
|
||||
assert kotlinFqName.startsWith(BUILTINS_FQNAME_PREFIX);
|
||||
String kotlinSubQualifiedName = kotlinFqName.substring(BUILTINS_FQNAME_PREFIX.length());
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ReferenceToClassesShortening {
|
||||
compactReferenceToClass(userType, targetClass);
|
||||
}
|
||||
else if (classifier == null) {
|
||||
ImportInsertHelper.addImportDirectiveIfNeeded(DescriptorUtils.getFQName(targetTopLevelClass).toSafe(), file);
|
||||
ImportInsertHelper.addImportDirectiveIfNeeded(DescriptorUtils.getFqName(targetTopLevelClass).toSafe(), file);
|
||||
compactReferenceToClass(userType, targetClass);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -76,7 +76,7 @@ public final class DescriptorLookupConverter {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
if (containingDeclaration != null && extensionFunction) {
|
||||
tailText += " for " + DescriptorRenderer.TEXT.renderType(functionDescriptor.getReceiverParameter().getType());
|
||||
tailText += " in " + DescriptorUtils.getFQName(containingDeclaration);
|
||||
tailText += " in " + DescriptorUtils.getFqName(containingDeclaration);
|
||||
}
|
||||
}
|
||||
else if (descriptor instanceof VariableDescriptor) {
|
||||
@@ -86,7 +86,7 @@ public final class DescriptorLookupConverter {
|
||||
else if (descriptor instanceof ClassDescriptor) {
|
||||
DeclarationDescriptor declaredIn = descriptor.getContainingDeclaration();
|
||||
assert declaredIn != null;
|
||||
tailText = " (" + DescriptorUtils.getFQName(declaredIn) + ")";
|
||||
tailText = " (" + DescriptorUtils.getFqName(declaredIn) + ")";
|
||||
tailTextGrayed = true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -282,7 +282,7 @@ private fun staticMembers(context: JetExpression, expectedType: JetType, resolve
|
||||
var builder = LookupElementBuilder.create(lookupElement.getObject(), classDescriptor.getName().asString() + "." + lookupElement.getLookupString())
|
||||
.withIcon(presentation.getIcon())
|
||||
.withStrikeoutness(presentation.isStrikeout())
|
||||
.withTailText(" (" + DescriptorUtils.getFQName(classDescriptor.getContainingDeclaration()) + ")")
|
||||
.withTailText(" (" + DescriptorUtils.getFqName(classDescriptor.getContainingDeclaration()) + ")")
|
||||
.withTypeText(if (!presentation.getTypeText().isNullOrEmpty())
|
||||
presentation.getTypeText()
|
||||
else
|
||||
|
||||
@@ -54,7 +54,7 @@ public class JetClassInsertHandler implements InsertHandler<LookupElement> {
|
||||
DeclarationDescriptor descriptor = lookupObject.getDescriptor();
|
||||
PsiElement targetElement = lookupObject.getPsiElement();
|
||||
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
|
||||
if (targetElement != null) {
|
||||
|
||||
@@ -177,7 +177,7 @@ public class JetFunctionInsertHandler(val caretPosition : CaretPosition, val bra
|
||||
|
||||
if (DescriptorUtils.isTopLevelDeclaration(functionDescriptor)) {
|
||||
ApplicationManager.getApplication()?.runWriteAction {
|
||||
val fqn = DescriptorUtils.getFQName(functionDescriptor).toSafe()
|
||||
val fqn = DescriptorUtils.getFqName(functionDescriptor).toSafe()
|
||||
ImportInsertHelper.addImportDirectiveIfNeeded(fqn, file)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class JetDeclarationRemotenessWeigher extends LookupElementWeigher {
|
||||
|
||||
DeclarationDescriptor descriptor = lookupObject.getDescriptor();
|
||||
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
|
||||
if (QualifiedNamesUtil.isValidJavaFqName(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.Name;
|
||||
import org.jetbrains.jet.plugin.project.AnalyzerFacadeWithCache;
|
||||
import org.jetbrains.jet.plugin.quickfix.ImportInsertHelper;
|
||||
import org.jetbrains.jet.util.QualifiedNamesUtil;
|
||||
|
||||
import java.util.*;
|
||||
@@ -184,7 +183,7 @@ public class JetImportOptimizer implements ImportOptimizer {
|
||||
private void addResolvedCallFqName(@Nullable ResolvedCall resolvedCall) {
|
||||
if (resolvedCall != null) {
|
||||
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();
|
||||
usedQualifiedNames.add(name.toSafe());
|
||||
}
|
||||
|
||||
@@ -247,7 +247,7 @@ public class DeprecatedAnnotationVisitor extends AfterAnalysisHighlightingVisito
|
||||
|
||||
private static String getDescriptorString(@NotNull DeclarationDescriptor descriptor) {
|
||||
if (descriptor instanceof ClassDescriptor) {
|
||||
return DescriptorUtils.getFQName(descriptor).asString();
|
||||
return DescriptorUtils.getFqName(descriptor).asString();
|
||||
}
|
||||
else if (descriptor instanceof ConstructorDescriptor) {
|
||||
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();
|
||||
|
||||
@@ -164,7 +164,7 @@ public class IdeRenderers {
|
||||
stringBuilder.append(" <i>defined in</i> ");
|
||||
DeclarationDescriptor containingDeclaration = funDescriptor.getContainingDeclaration();
|
||||
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("</li>");
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.jet.lang.resolve.name.FqName;
|
||||
|
||||
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 {
|
||||
|
||||
@@ -65,7 +65,7 @@ public final class DecompiledNavigationUtils {
|
||||
return jetDeclaration;
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ public final class DecompiledNavigationUtils {
|
||||
if (classKind == ClassKind.CLASS_OBJECT || classKind == ClassKind.ENUM_ENTRY) {
|
||||
return getContainerFqName(containerDescriptor.getContainingDeclaration());
|
||||
}
|
||||
return getFQName(containerDescriptor).toSafe();
|
||||
return getFqName(containerDescriptor).toSafe();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -353,7 +353,7 @@ public class JetSourceNavigationHelper {
|
||||
assert className != null : "Class from BuiltIns should have a name";
|
||||
ClassDescriptor classDescriptor = KotlinBuiltIns.getInstance().getBuiltInClassByName(className);
|
||||
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFQName(classDescriptor);
|
||||
FqNameUnsafe fqName = DescriptorUtils.getFqName(classDescriptor);
|
||||
if (fqName.isSafe()) {
|
||||
FqName javaFqName = KotlinToJavaTypesMap.getInstance().getKotlinToJavaFqName(fqName.toSafe());
|
||||
if (javaFqName != null) {
|
||||
|
||||
@@ -125,7 +125,7 @@ public class AutoImportFix extends JetHintAction<JetSimpleNameExpression> implem
|
||||
@Override
|
||||
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
|
||||
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
|
||||
public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
|
||||
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>() {
|
||||
@Override
|
||||
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.BindingContextUtils;
|
||||
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.scopes.JetScope;
|
||||
import org.jetbrains.jet.lang.types.*;
|
||||
@@ -902,7 +901,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
|
||||
assert returnTypeRef != null;
|
||||
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(ATTRIBUTE_FUNCTION_NAME, functionName);
|
||||
|
||||
@@ -1060,7 +1059,7 @@ public class CreateFunctionFromUsageFix extends CreateFromUsageFixBase {
|
||||
String replacement = typeParameterNameMap.get(declarationDescriptor);
|
||||
return replacement == null ? declarationDescriptor.getName().asString() : replacement;
|
||||
} 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();
|
||||
}
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -78,7 +78,7 @@ public class KotlinAnnotatedElementsSearcher extends AnnotatedElementsSearcher {
|
||||
|
||||
ClassifierDescriptor descriptor = annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
|
||||
if (descriptor == null) return;
|
||||
if (!(DescriptorUtils.getFQName(descriptor).asString().equals(annotationFQN))) return;
|
||||
if (!(DescriptorUtils.getFqName(descriptor).asString().equals(annotationFQN))) return;
|
||||
|
||||
if (parentOfType instanceof JetClass) {
|
||||
PsiClass lightClass = LightClassUtil.getPsiClass((JetClass) parentOfType);
|
||||
|
||||
@@ -225,7 +225,7 @@ public class JetStructureViewElement implements StructureViewTreeElement {
|
||||
textBuilder = new StringBuilder(descriptor.getName().asString());
|
||||
textBuilder
|
||||
.append(" (")
|
||||
.append(DescriptorUtils.getFQName(descriptor.getContainingDeclaration()))
|
||||
.append(DescriptorUtils.getFqName(descriptor.getContainingDeclaration()))
|
||||
.append(")");
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.jetbrains.jet.lang.resolve.name.Name;
|
||||
|
||||
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.
|
||||
@@ -153,12 +153,12 @@ public final class StandardClasses {
|
||||
}
|
||||
|
||||
public boolean isStandardObject(@NotNull DeclarationDescriptor descriptor) {
|
||||
return standardObjects.containsKey(getFQName(descriptor));
|
||||
return standardObjects.containsKey(getFqName(descriptor));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public JsName getStandardObjectName(@NotNull DeclarationDescriptor descriptor) {
|
||||
return standardObjects.get(getFQName(descriptor));
|
||||
return standardObjects.get(getFqName(descriptor));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public final class PatternBuilder {
|
||||
}
|
||||
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ public final class AnnotationsUtils {
|
||||
DeclarationDescriptor annotationDeclaration =
|
||||
annotationDescriptor.getType().getConstructor().getDeclarationDescriptor();
|
||||
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) {
|
||||
|
||||
@@ -36,12 +36,12 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
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 {
|
||||
// TODO: maybe we should use external annotations or something else.
|
||||
private static final Set<String> FAKE_CLASSES = ContainerUtil.immutableSet(
|
||||
getFQName(KotlinBuiltIns.getInstance().getAny()).toSafe().asString(),
|
||||
getFqName(KotlinBuiltIns.getInstance().getAny()).toSafe().asString(),
|
||||
"jet.Iterable"
|
||||
);
|
||||
|
||||
@@ -82,7 +82,7 @@ public final class JsDescriptorUtils {
|
||||
@Override
|
||||
public boolean value(JetType 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 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.utils.BindingUtils.getFunctionDescriptorForOperationExpression;
|
||||
import static org.jetbrains.k2js.translate.utils.JsAstUtils.assignment;
|
||||
@@ -133,7 +133,7 @@ public final class TranslationUtils {
|
||||
|
||||
@NotNull
|
||||
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) + "$";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user