diff options
author | w0rp <devw0rp@gmail.com> | 2017-05-04 23:19:58 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-05-04 23:19:58 +0100 |
commit | 8e70dc14f2a51f0ef7acb64c3ef9850cb4f23e64 (patch) | |
tree | b123ebf4d721217c7a6dbb8fb6222c9855e64584 /ale_linters/java | |
parent | 528355e2c6cf64fbc0d459a7a512a7823f90043d (diff) | |
download | ale-8e70dc14f2a51f0ef7acb64c3ef9850cb4f23e64.zip |
Fix #502 - Report undefined symbol errors better for javac
Diffstat (limited to 'ale_linters/java')
-rw-r--r-- | ale_linters/java/javac.vim | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim index 4e91c4f6..4dbc6cb6 100644 --- a/ale_linters/java/javac.vim +++ b/ale_linters/java/javac.vim @@ -85,15 +85,23 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated " Main.java:16: error: ';' expected - let l:pattern = '^.*\:\(\d\+\):\ \(.*\):\(.*\)$' + let l:pattern = '\v^.*:(\d+): (.+):(.+)$' + let l:symbol_pattern = '\v^ +symbol: *(class) +([^ ]+)' let l:output = [] - for l:match in ale#util#GetMatches(a:lines, l:pattern) - call add(l:output, { - \ 'lnum': l:match[1] + 0, - \ 'text': l:match[2] . ':' . l:match[3], - \ 'type': l:match[2] ==# 'error' ? 'E' : 'W', - \}) + for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:symbol_pattern]) + if 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] + endif + else + call add(l:output, { + \ 'lnum': l:match[1] + 0, + \ 'text': l:match[2] . ':' . l:match[3], + \ 'type': l:match[2] ==# 'error' ? 'E' : 'W', + \}) + endif endfor return l:output |