Introduced getFqNameSafe method.

This commit is contained in:
Evgeny Gerashchenko
2013-12-04 18:51:06 +04:00
parent 3352d8a954
commit a49551dd35
22 changed files with 50 additions and 37 deletions
@@ -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();
@@ -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",
@@ -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()));
}