Open ghost opened 1 year ago
$ scoop install openjdk17
$ java --version # make sure java version is >= 16
$ scoop install ktlint
$ ktlint -F # <- will directly show this error
Followed the steps above though didn't find any error. Maybe the fixes are already upstream?
My config:
PS C:\dev> java --version
openjdk 17.0.2 2022-01-18
OpenJDK Runtime Environment (build 17.0.2+8-86)
OpenJDK 64-Bit Server VM (build 17.0.2+8-86, mixed mode, sharing)
PS C:\dev> ktlint --version
1.0.0
Prerequisites
Package Name
ktlint
Expected/Current Behaviour
I have the following relevant scoop packages installed:
openjdk17: 17.0.2-8 (latest version) ktlint: 0.48.2 (latest version)
When running ktlint (eg
ktlint -F
), I see the following stack trace:This error is mentioned at https://github.com/pinterest/ktlint/issues/1195 and was fixed last year. It seems that all Java 16+ version cause this problem. The fix was done by calling java using
--add-opens java.base/java.lang=ALL-UNNAMED
. Unfortunately, scoop writes its own start script in/c/Users/me/scoop/shims/ktlint
which doesn't contain such a fix:Steps to Reproduce
Possible Solution
The following patch fixes the issue:
Same should be done with
/c/Users/me/scoop/shims/ktlint.cmd
.This is the same solution as described in https://github.com/pinterest/ktlint/issues/1195.
Scoop and Buckets Version
Scoop Config
PowerShell Version
using git bash
Additional Softwares
No response