Skip to content

Commit

Permalink
Detect JDK version and modify java args accordingly
Browse files Browse the repository at this point in the history
  • Loading branch information
skuro committed Sep 4, 2019
1 parent 5889166 commit 2fd42ff
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions plantuml-mode.el
Expand Up @@ -241,6 +241,15 @@
(message "Aborted."))
(message "Aborted.")))

(defun plantuml-jar-java-version ()
"Inspects the Java runtime version of the configured Java command in `plantuml-java-command'."
(save-excursion
(save-match-data
(with-temp-buffer
(call-process plantuml-java-command nil t nil "-XshowSettings:properties" "-version")
(re-search-backward "java.version = \\(1.\\)?\\([[:digit:]]+\\)")
(string-to-number (match-string 2))))))

(defun plantuml-jar-get-language (buf)
"Retrieve the language specification from the PlantUML JAR file and paste it into BUF."
(unless (or (eq system-type 'cygwin) (file-exists-p plantuml-jar-path))
Expand Down Expand Up @@ -358,13 +367,16 @@ Note that output type `txt' is promoted to `utxt' for better rendering."

(defun plantuml-jar-start-process (buf)
"Run PlantUML as an Emacs process and puts the output into the given buffer (as BUF)."
(apply #'start-process
"PLANTUML" buf plantuml-java-command
`(,@plantuml-java-args
,(expand-file-name plantuml-jar-path)
,(plantuml-jar-output-type-opt plantuml-output-type)
,@plantuml-jar-args
"-p")))
(let ((java-args (if (<= 8 (plantuml-jar-java-version))
(remove "--illegal-access=deny" plantuml-java-args)
plantuml-java-args)))
(apply #'start-process
"PLANTUML" buf plantuml-java-command
`(,@java-args
,(expand-file-name plantuml-jar-path)
,(plantuml-jar-output-type-opt plantuml-output-type)
,@java-args
"-p"))))

(defun plantuml-executable-start-process (buf)
"Run PlantUML as an Emacs process and puts the output into the given buffer (as BUF)."
Expand Down

0 comments on commit 2fd42ff

Please sign in to comment.