You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
running ktlint with JAVA_TOOL_OPTIONS set should not produce an error
Observed Behavior
running ktlint with JAVA_TOOL_OPTIONS produces the following error
/usr/local/Cellar/ktlint/0.46.1/libexec/ktlint: line 5: [: Picked up JAVA_TOOL_OPTIONS: integer expression expected
Steps to Reproduce
download ktlint
export some JAVA_TOOL_OPTIONS
run ktlint
Your Environment
Version of ktlint used: 0.46.1
Relevant parts of the .editorconfig settings: n/a
Name and version (or code for custom task) of integration used (Gradle plugin, Maven plugin, command line, custom Gradle task): n/a
Version of Gradle used (if applicable): n/a
Operating System and version: macos 12.3
i have JAVA_TOOL_OPTIONS set
Investigation
This seems to be happening from these two lines in the ktlint start
# incorrectly retrieves version
JV=$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)
echo $JV
# echoes 'Picked up JAVA_TOOL_OPTIONS:'
X=$( [ "$JV" -ge "16" ] && echo "--add-opens java.base/java.lang=ALL-UNNAMED" || echo "")
# this command fails because the version is not correctly parsed
Ktlint still runs okay, it just spits some errors in the beginning. This could be solved with a different way to get the java version. Perhaps something with sed or awk to search for the 'version' string instead of head.
The text was updated successfully, but these errors were encountered:
Expected Behavior
running ktlint with JAVA_TOOL_OPTIONS set should not produce an error
Observed Behavior
running ktlint with JAVA_TOOL_OPTIONS produces the following error
Steps to Reproduce
download ktlint
export some JAVA_TOOL_OPTIONS
run ktlint
Your Environment
.editorconfig
settings: n/aInvestigation
This seems to be happening from these two lines in the ktlint start
Ktlint still runs okay, it just spits some errors in the beginning. This could be solved with a different way to get the java version. Perhaps something with sed or awk to search for the 'version' string instead of head.
The text was updated successfully, but these errors were encountered: