-
Notifications
You must be signed in to change notification settings - Fork 0
/
flymake-eclim-java.el
33 lines (28 loc) · 1.37 KB
/
flymake-eclim-java.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;; (require 'flymake)
(defvar flymake-eclipse-batch-compiler-path
"/usr/lib64/eclipse/plugins/org.eclipse.jdt.core_3.8.2.v20120814-155456.jar")
;; TODO fix hardcoded 1.6
(defvar flymake-java-version "1.6")
(defun flymake-java-ecj-init ()
(let* ((temp-file (flymake-init-create-temp-buffer-copy
'flymake-ecj-create-temp-file))
(local-file (file-relative-name
temp-file
(file-name-directory buffer-file-name))))
(list "java" (list "-jar" flymake-eclipse-batch-compiler-path "-Xemacs" "-d" "none"
"-warn:+over-ann,uselessTypeCheck";;,allJavadoc"
"-source" flymake-java-version "-target" flymake-java-version "-proceedOnError"
"-classpath" (eclim/project-classpath)
;; "-log" "c:/temp/foo.xml"
local-file))))
(defun flymake-java-ecj-cleanup ()
"Cleanup after `flymake-java-ecj-init' -- delete temp file and dirs."
(flymake-safe-delete-file flymake-temp-source-file-name)
(when flymake-temp-source-file-name
(flymake-safe-delete-directory (file-name-directory flymake-temp-source-file-name))))
(defun flymake-ecj-create-temp-file (file-name prefix)
"Create the file FILE-NAME in a unique directory in the temp directory."
(file-truename (expand-file-name (file-name-nondirectory file-name)
(expand-file-name (int-to-string (abs (random))) (flymake-get-temp-dir)))))
(push '(".+\\.java$" flymake-java-ecj-init flymake-java-ecj-cleanup) flymake-allowed-file-name-masks)
(provide 'flymake-eclim-java)