Minor, improve exception message for non-deserialized types

This commit is contained in:
Alexander Udalov
2015-09-10 19:20:36 +03:00
parent 3e5c8d1b79
commit 4dbfce605e
@@ -58,6 +58,7 @@ import org.jetbrains.kotlin.resolve.jvm.JvmPrimitiveType;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterKind;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodParameterSignature;
import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature; import org.jetbrains.kotlin.resolve.jvm.jvmSignature.JvmMethodSignature;
import org.jetbrains.kotlin.serialization.deserialization.DeserializedType;
import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor; import org.jetbrains.kotlin.serialization.deserialization.descriptors.DeserializedCallableMemberDescriptor;
import org.jetbrains.kotlin.types.*; import org.jetbrains.kotlin.types.*;
import org.jetbrains.kotlin.types.expressions.OperatorConventions; import org.jetbrains.kotlin.types.expressions.OperatorConventions;
@@ -436,14 +437,14 @@ public class JetTypeMapper {
PsiElement declarationElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor); PsiElement declarationElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor);
if (declarationElement == null) { if (declarationElement == null) {
return String.format( String message = "Error type encountered: %s (%s).";
"Error type encountered: %s (%s). " + if (TypesPackage.upperIfFlexible(type) instanceof DeserializedType) {
"One of the possible reasons may be that this type is not directly accessible from this module. " + message +=
"To workaround this error, try adding an explicit dependency on the module or library which contains this type " + " One of the possible reasons may be that this type is not directly accessible from this module. " +
"to the classpath", "To workaround this error, try adding an explicit dependency on the module or library which contains this type " +
type, "to the classpath";
type.getClass().getSimpleName() }
); return String.format(message, type, type.getClass().getSimpleName());
} }
DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration(); DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();