Skip to content

Commit f1db0ef

Browse files
committed
Do not display error location when unknown
Closes gh-36041
1 parent e9a4b93 commit f1db0ef

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,9 +365,11 @@ private String toMessage(Diagnostic<? extends JavaFileObject> diagnostic) {
365365
if (diagnostic.getSource() != null) {
366366
message.append(' ');
367367
message.append(diagnostic.getSource().getName());
368-
message.append(' ');
369-
message.append(diagnostic.getLineNumber()).append(':')
370-
.append(diagnostic.getColumnNumber());
368+
if (diagnostic.getLineNumber() != -1 && diagnostic.getColumnNumber() != -1) {
369+
message.append(' ');
370+
message.append(diagnostic.getLineNumber()).append(':')
371+
.append(diagnostic.getColumnNumber());
372+
}
371373
}
372374
return message.toString();
373375
}

0 commit comments

Comments
 (0)