Fixed printing multiple errors in Kotlin signatures.

This commit is contained in:
Evgeny Gerashchenko
2012-11-20 20:45:02 +04:00
parent cda953942d
commit 19e283a333
4 changed files with 22 additions and 9 deletions
@@ -121,19 +121,23 @@ public final class AnalyzerWithCompilerReport {
BindingContext bc = analyzeExhaust.getBindingContext();
Collection<DeclarationDescriptor> descriptorsWithErrors = bc.getKeys(BindingContext.LOAD_FROM_JAVA_SIGNATURE_ERRORS);
if (!descriptorsWithErrors.isEmpty()) {
StringBuilder messageStart = new StringBuilder("The following Java entities have annotations wrong Kotlin signatures:\n");
StringBuilder message = new StringBuilder("The following Java entities have annotations wrong Kotlin signatures:\n");
for (DeclarationDescriptor descriptor : descriptorsWithErrors) {
PsiElement declaration = BindingContextUtils.descriptorToDeclaration(bc, descriptor);
assert declaration instanceof PsiModifierListOwner;
String externalName = PsiFormatUtil.getExternalName((PsiModifierListOwner) declaration);
messageStart.append(externalName).append(": ");
List<String> errors = bc.get(BindingContext.LOAD_FROM_JAVA_SIGNATURE_ERRORS, descriptor);
assert errors != null;
assert errors != null && !errors.isEmpty();
String externalName = PsiFormatUtil.getExternalName((PsiModifierListOwner) declaration);
message.append(externalName).append(":\n");
for (String error : errors) {
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR,
messageStart + error + "\n", CompilerMessageLocation.NO_LOCATION);
message.append(" ").append(error).append("\n");
}
}
messageCollectorWrapper.report(CompilerMessageSeverity.ERROR,
message.toString(), CompilerMessageLocation.NO_LOCATION);
}
}