CLI: don't render non-positive line and column in error messages
This commit is contained in:
+16
-2
@@ -87,9 +87,23 @@ public interface MessageRenderer {
|
||||
public String render(
|
||||
@NotNull CompilerMessageSeverity severity, @NotNull String message, @NotNull CompilerMessageLocation location
|
||||
) {
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.append(severity).append(": ");
|
||||
|
||||
String path = getPath(location);
|
||||
String position = path == null ? "" : path + ": (" + (location.getLine() + ", " + location.getColumn()) + ") ";
|
||||
return severity + ": " + position + message;
|
||||
if (path != null) {
|
||||
result.append(path);
|
||||
result.append(": ");
|
||||
if (location.getLine() > 0 && location.getColumn() > 0) {
|
||||
result.append("(");
|
||||
result.append(location.getLine()).append(", ").append(location.getColumn());
|
||||
result.append(") ");
|
||||
}
|
||||
}
|
||||
|
||||
result.append(message);
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ public final class AnalyzerWithCompilerReport {
|
||||
CompilerMessageSeverity.ERROR,
|
||||
"Class '" + JvmClassName.byClassId(data.getClassId()) + "' was compiled with an incompatible version of Kotlin. " +
|
||||
"Its ABI version is " + data.getActualVersion() + ", expected ABI version is " + JvmAbi.VERSION,
|
||||
CompilerMessageLocation.create(path, 0, 0)
|
||||
CompilerMessageLocation.create(path, -1, -1)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: (0, 0) Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/wrong/WrongPackage.class: (0, 0) Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/ClassWithWrongAbiVersion.class: Class 'ClassWithWrongAbiVersion' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersionLib/bin/wrong/WrongPackage.class: Class 'wrong/WrongPackage' was compiled with an incompatible version of Kotlin. Its ABI version is -1, expected ABI version is $ABI_VERSION$
|
||||
ERROR: compiler/testData/cli/jvm/wrongAbiVersion.kt: (4, 3) Unresolved reference: bar
|
||||
COMPILATION_ERROR
|
||||
Reference in New Issue
Block a user