Change DeserializedContainerSource.presentableFqName to String

To allow outputting something other than "Class 'XXX'" in the diagnostic
message for declarations deserialized from JS
This commit is contained in:
Alexander Udalov
2017-02-09 15:51:37 +03:00
parent f120865350
commit de8dd37e44
6 changed files with 14 additions and 16 deletions
@@ -99,8 +99,8 @@ public interface Errors {
DiagnosticFactory2<PsiElement, String, String> API_NOT_AVAILABLE = DiagnosticFactory2.create(ERROR);
DiagnosticFactory1<PsiElement, FqName> MISSING_DEPENDENCY_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory1<PsiElement, FqName> PRE_RELEASE_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory2<PsiElement, FqName, IncompatibleVersionErrorData<?>> INCOMPATIBLE_CLASS = DiagnosticFactory2.create(ERROR);
DiagnosticFactory1<PsiElement, String> PRE_RELEASE_CLASS = DiagnosticFactory1.create(ERROR);
DiagnosticFactory2<PsiElement, String, IncompatibleVersionErrorData<?>> INCOMPATIBLE_CLASS = DiagnosticFactory2.create(ERROR);
//Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
//"INVISIBLE_REFERENCE" is used for invisible classes references and references in import
@@ -358,9 +358,9 @@ public class DefaultErrorMessages {
MAP.put(API_NOT_AVAILABLE, "This declaration is only available since Kotlin {0} and cannot be used with the specified API version {1}", STRING, STRING);
MAP.put(MISSING_DEPENDENCY_CLASS, "Cannot access class ''{0}''. Check your module classpath for missing or conflicting dependencies", TO_STRING);
MAP.put(PRE_RELEASE_CLASS, "Class ''{0}'' is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler", TO_STRING);
MAP.put(PRE_RELEASE_CLASS, "{0} is compiled by a pre-release version of Kotlin and cannot be loaded by this version of the compiler", TO_STRING);
MAP.put(INCOMPATIBLE_CLASS,
"Class ''{0}'' was compiled with an incompatible version of Kotlin. {1}",
"{0} was compiled with an incompatible version of Kotlin. {1}",
TO_STRING, new DiagnosticParameterRenderer<IncompatibleVersionErrorData<?>>() {
@NotNull
@Override
@@ -59,10 +59,10 @@ object MissingDependencyClassChecker : CallChecker {
if (source is DeserializedContainerSource) {
val incompatibility = source.incompatibility
if (incompatibility != null) {
return INCOMPATIBLE_CLASS.on(reportOn, source.presentableFqName, incompatibility)
return INCOMPATIBLE_CLASS.on(reportOn, source.presentableString, incompatibility)
}
if (source.isPreReleaseInvisible) {
return PRE_RELEASE_CLASS.on(reportOn, source.presentableFqName)
return PRE_RELEASE_CLASS.on(reportOn, source.presentableString)
}
}