Introduced getFqNameSafe 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.getFqNameSafe(declarationDescriptor));
|
||||
}
|
||||
|
||||
public static boolean isOptimizableRangeTo(CallableDescriptor rangeTo) {
|
||||
|
||||
@@ -135,7 +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(
|
||||
Integer.toHexString(CodegenUtil.getPathHashCode(containingFile.getVirtualFile()) * 31 + DescriptorUtils.getFqNameSafe(
|
||||
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(getFqNameSafe(KotlinBuiltIns.getInstance().getUnit()), Name.identifier("VALUE"));
|
||||
|
||||
for (PrimitiveType type : PrimitiveType.NUMBER_TYPES) {
|
||||
FqName rangeClassFqName = RangeCodegenUtil.getRangeClassFqName(type);
|
||||
|
||||
+1
-1
@@ -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.getFqNameSafe(klass);
|
||||
|
||||
for (FunctionDescriptor fun : klass.getDefaultType().getMemberScope().getFunctions(functionName)) {
|
||||
CallableMemberDescriptor.Kind kind = fun.getKind();
|
||||
|
||||
+2
-2
@@ -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.getFqNameSafe(classDescriptor).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.getFqNameSafe(declarationDescriptor);
|
||||
ClassDescriptor classFromLibrary = getAutoTypeAnalogWithinBuiltins(originalClassFqName, qualifiedName);
|
||||
if (!isSameName(qualifiedName, originalClassFqName.asString()) && classFromLibrary == null) {
|
||||
throw new AlternativeSignatureMismatchException("Alternative signature type mismatch, expected: %s, actual: %s",
|
||||
|
||||
+1
-3
@@ -97,9 +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);
|
||||
assert fqNameUnsafe.isSafe() : "FQ name of a mapped class should be safe: " + fqNameUnsafe;
|
||||
FqName fqName = fqNameUnsafe.toSafe();
|
||||
FqName fqName = DescriptorUtils.getFqNameSafe(kotlinDescriptor);
|
||||
register(fqName, AsmTypeConstants.getType(javaClass));
|
||||
registerFqName(fqName, new FqName(javaClass.getCanonicalName()));
|
||||
}
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ public class QualifiedExpressionResolver {
|
||||
}
|
||||
|
||||
if (packageView != null && classDescriptor != null) {
|
||||
if (DescriptorUtils.getFqName(packageView).equalsTo(DescriptorUtils.getFqName(classDescriptor))) {
|
||||
if (packageView.getFqName().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
@@ -47,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.getFqNameSafe(thisDescriptor), name);
|
||||
return super.getClassifier(actualName);
|
||||
}
|
||||
|
||||
|
||||
@@ -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.getFqNameSafe(descriptor)).isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user