From 4dbfce605e915c0494946d8ba76909b296e7ff9c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Thu, 10 Sep 2015 19:20:36 +0300 Subject: [PATCH] Minor, improve exception message for non-deserialized types --- .../kotlin/codegen/state/JetTypeMapper.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java index 7eef1b75aa2..22600fc2660 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/state/JetTypeMapper.java @@ -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.JvmMethodParameterSignature; 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.types.*; import org.jetbrains.kotlin.types.expressions.OperatorConventions; @@ -436,14 +437,14 @@ public class JetTypeMapper { PsiElement declarationElement = DescriptorToSourceUtils.descriptorToDeclaration(descriptor); if (declarationElement == null) { - return String.format( - "Error type encountered: %s (%s). " + - "One of the possible reasons may be that this type is not directly accessible from this module. " + - "To workaround this error, try adding an explicit dependency on the module or library which contains this type " + - "to the classpath", - type, - type.getClass().getSimpleName() - ); + String message = "Error type encountered: %s (%s)."; + if (TypesPackage.upperIfFlexible(type) instanceof DeserializedType) { + message += + " One of the possible reasons may be that this type is not directly accessible from this module. " + + "To workaround this error, try adding an explicit dependency on the module or library which contains this type " + + "to the classpath"; + } + return String.format(message, type, type.getClass().getSimpleName()); } DeclarationDescriptor containingDeclaration = descriptor.getContainingDeclaration();