Minor, improve exception message for non-deserialized types
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user