Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ale_linters/java/javac.vim
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
" Main.java:16: error: ';' expected

let l:pattern = '\v^.*:(\d+): (.+):(.+)$'
let l:col_pattern = '\v^(\s*\^)$'
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
let l:output = []

for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:symbol_pattern])
if empty(l:match[3])
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern])
if empty(l:match[2]) && empty(l:match[3])
let l:output[-1].col = len(l:match[1])
elseif empty(l:match[3])
" Add symbols to 'cannot find symbol' errors.
if l:output[-1].text ==# 'error: cannot find symbol'
let l:output[-1].text .= ': ' . l:match[2]
Expand Down
3 changes: 3 additions & 0 deletions test/handler/test_javac_handler.vader
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ Execute(The javac handler should handle cannot find symbol errors):
\ },
\ {
\ 'lnum': 2,
\ 'col': 5,
\ 'text': 'error: cannot find symbol: BadName',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 34,
\ 'col': 5,
\ 'text': 'error: cannot find symbol: BadName2',
\ 'type': 'E',
\ },
Expand All @@ -29,6 +31,7 @@ Execute(The javac handler should handle cannot find symbol errors):
\ },
\ {
\ 'lnum': 42,
\ 'col': 11,
\ 'text': 'error: cannot find symbol: bar()',
\ 'type': 'E',
\ },
Expand Down