(lsp-java--get-java-version) buggy
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
Research direction
Search the repository for lsp-java--get-java-version and inspect how it parses the output of java -version. Reproduce the parsing with the JAVA_TOOL_OPTIONS output shown here, then verify that the function extracts the Java version correctly and that existing checks still pass.
Written by the indexing model from the issue text.
Description
Describe the bug
I see that this is parsing the shell output of java -version and that seems to break:
$ java -version
Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
openjdk version "17.0.8.1" 2023-08-24
OpenJDK Runtime Environment Homebrew (build 17.0.8.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.8.1+0, mixed mode, sharing)
Output of (shell-command-to-string "java -version"):
"Picked up JAVA_TOOL_OPTIONS: -Dlog4j2.formatMsgNoLookups=true
openjdk version \"17.0.8.1\" 2023-08-24
OpenJDK Runtime Environment Homebrew (build 17.0.8.1+0)
OpenJDK 64-Bit Server VM Homebrew (build 17.0.8.1+0, mixed mode, sharing)
"
Can be fixed by tweaking the command as follows:
(defun lsp-java--get-java-version ()
"Retrieve the java version from shell command."
(let* ((java-version-output (shell-command-to-string (concat lsp-java-java-path " -version")))
(version-string (nth 0 (split-string (nth 1 (split-string java-version-output "version"))))))
(string-to-number (replace-regexp-in-string "\"" "" version-string))))
- Dominant language
- Emacs Lisp
- Stars
- 695
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from emacs-lsp/lsp-java
-
dap-java discards module paths from resolveClasspath causing JPMS-modular projects fail to launchOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
All issues in emacs-lsp/lsp-java
Similar issues
-
[doc-healer] DDUw improvement: retry integrity-filtered issue reads with direct single-item lookupsOpenautomation documentation
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
diegosouzapw/OmniRoute#18387 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
davidjerleke/embla-carousel#1414 ·
Maintainers usually reply within 4 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day