Merge pull request #2134 from oaue/master

javac linter: fix handling of error messages containing ':' character
This commit is contained in:
w0rp 2019-05-08 09:50:12 +01:00 committed by w0rp
parent 0927634916
commit 9778a6e5b5
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83
2 changed files with 12 additions and 2 deletions

View File

@ -99,7 +99,7 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated " Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
" Main.java:16: error: ';' expected " Main.java:16: error: ';' expected
let l:directory = expand('#' . a:buffer . ':p:h') let l:directory = expand('#' . a:buffer . ':p:h')
let l:pattern = '\v^(.*):(\d+): (.+):(.+)$' let l:pattern = '\v^(.*):(\d+): (.{-1,}):(.+)$'
let l:col_pattern = '\v^(\s*\^)$' let l:col_pattern = '\v^(\s*\^)$'
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)' let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
let l:output = [] let l:output = []

View File

@ -44,6 +44,13 @@ Execute(The javac handler should handle cannot find symbol errors):
\ 'text': 'error: cannot find symbol: bar()', \ 'text': 'error: cannot find symbol: bar()',
\ 'type': 'E', \ 'type': 'E',
\ }, \ },
\ {
\ 'filename': ale#path#Simplify('/tmp/vLPr4Q5/33/foo.java'),
\ 'lnum': 58,
\ 'col': 19,
\ 'text': 'error: incompatible types: Bar cannot be converted to Foo',
\ 'type': 'E',
\ },
\ ], \ ],
\ ale_linters#java#javac#Handle(bufnr(''), [ \ ale_linters#java#javac#Handle(bufnr(''), [
\ '/tmp/vLPr4Q5/33/foo.java:1: error: some error', \ '/tmp/vLPr4Q5/33/foo.java:1: error: some error',
@ -62,7 +69,10 @@ Execute(The javac handler should handle cannot find symbol errors):
\ ' this.bar();', \ ' this.bar();',
\ ' ^', \ ' ^',
\ ' symbol: method bar()', \ ' symbol: method bar()',
\ '5 errors', \ '/tmp/vLPr4Q5/33/foo.java:58: error: incompatible types: Bar cannot be converted to Foo',
\ ' this.setFoo(bar);',
\ ' ^',
\ '6 errors',
\ ]) \ ])
Execute(The javac handler should resolve files from different directories): Execute(The javac handler should resolve files from different directories):