summaryrefslogtreecommitdiff
path: root/ale_linters/java/javac.vim
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
committerw0rp <devw0rp@gmail.com>2018-08-02 23:44:12 +0100
commit217284360d35711b751859ed27a7a3c3da300e85 (patch)
tree4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/java/javac.vim
parent9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff)
downloadale-217284360d35711b751859ed27a7a3c3da300e85.zip
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/java/javac.vim')
-rw-r--r--ale_linters/java/javac.vim10
1 files changed, 2 insertions, 8 deletions
diff --git a/ale_linters/java/javac.vim b/ale_linters/java/javac.vim
index d7a39aa7..76445c18 100644
--- a/ale_linters/java/javac.vim
+++ b/ale_linters/java/javac.vim
@@ -36,10 +36,6 @@ function! s:BuildClassPathOption(buffer, import_paths) abort
\ : ''
endfunction
-function! ale_linters#java#javac#GetExecutable(buffer) abort
- return ale#Var(a:buffer, 'java_javac_executable')
-endfunction
-
function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths)
let l:sp_option = ''
@@ -77,13 +73,11 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
" Create .class files in a temporary directory, which we will delete later.
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
- let l:executable = ale_linters#java#javac#GetExecutable(a:buffer)
" Always run javac from the directory the file is in, so we can resolve
" relative paths correctly.
return ale#path#BufferCdString(a:buffer)
- \ . ale#Escape(l:executable)
- \ . ' -Xlint'
+ \ . '%e -Xlint'
\ . ale#Pad(l:cp_option)
\ . ale#Pad(l:sp_option)
\ . ' -d ' . ale#Escape(l:class_file_directory)
@@ -126,7 +120,7 @@ endfunction
call ale#linter#Define('java', {
\ 'name': 'javac',
-\ 'executable_callback': 'ale_linters#java#javac#GetExecutable',
+\ 'executable_callback': ale#VarFunc('java_javac_executable'),
\ 'command_chain': [
\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'},