AntMessage (@AntMessage.Priority int priority, @NlsSafe String text) { text = StringUtil.trimStart(text, FILE_PREFIX); int afterLineNumberIndex = text.indexOf(": "); // end of file_name_and_line_number sequence if (afterLineNumberIndex != -1) { String fileAndLineNumber = text.substring(0, afterLineNumberIndex); int index = fileAndLineNumber.lastIndexOf(':'); if (index != -1) { try { String lineNumberStr = fileAndLineNumber.substring(index + 1).trim(); int line = Integer.parseInt(lineNumberStr); String fileName = fileAndLineNumber.substring(0, index); final File file = new File(fileName); final VirtualFile result = ReadAction.compute(() -> { String url = VirtualFileManager.constructUrl(LocalFileSystem.PROTOCOL, file.getAbsolutePath().replace(File.separatorChar, '/')); return VirtualFileManager.getInstance().findFileByUrl(url); }); // convert separators text = fileName.replace('/', File.separatorChar) + ':' + line + text.substring(afterLineNumberIndex); return new AntMessage(MessageType.ERROR, priority, text, result, line, 1); } catch (NumberFormatException ignored) { } } } return new AntMessage(MessageType.ERROR, priority, text, null, 0, 0); }