Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

ktlint exception when using java 9 #152

Closed
impatient opened this issue Feb 5, 2018 · 6 comments · Fixed by #153
Closed

ktlint exception when using java 9 #152

impatient opened this issue Feb 5, 2018 · 6 comments · Fixed by #153

Comments

@impatient
Copy link

Using ktlint from brew, version 0.15.0. Works fine on Java 8, switched to Java 9 using jenv and get the following error.

Exception in thread "Thread-0" java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class com.github.shyiko.ktlint.core.KtLint
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
	at com.github.shyiko.ktlint.Main$parallel$consumer$1.run(Main.kt:614)
	at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.github.shyiko.ktlint.core.KtLint
	at com.github.shyiko.ktlint.Main.lint(Main.kt:585)

Command is simply: ktlint

@impatient impatient changed the title ktlint fails when using java 9 ktlint exception when using java 9 Feb 5, 2018
@shyiko shyiko reopened this Feb 13, 2018
@shyiko
Copy link
Collaborator

shyiko commented Feb 13, 2018

#153 merged in but there are still couple of things that need to be fixed before this ticket can be closed:

$ ktlint --version
null

and

$ ktlint
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.jetbrains.kotlin.com.intellij.util.text.StringFactory (file:/tmp/ktlint/ktlint/target/ktlint) to constructor java.lang.String(char[],boolean)
WARNING: Please consider reporting this to the maintainers of org.jetbrains.kotlin.com.intellij.util.text.StringFactory
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

+ verify together with maven/gradle.

@ifrins
Copy link
Contributor

ifrins commented Feb 16, 2018

The exception and the version showing have been fixed. What’s remaining is the illegal reflective access. This is a Kotlin compiler that has already been resolved upstream KT-19051 and will land when Kotlin 1.2.30 is released.

@shyiko do you have any plans for a release that is compatible with java 9?

@shyiko
Copy link
Collaborator

shyiko commented Feb 16, 2018

@ifrins as soon as Kotlin 1.2.30 is out

binkley pushed a commit to binkley/sproingk that referenced this issue Feb 21, 2018
Note: build hangs with Java 9, to hopefully be fixed soon.  See:
pinterest/ktlint#152.
@shyiko
Copy link
Collaborator

shyiko commented Feb 27, 2018

UPDATE:

0.16.0 released with @ifrins fixes included (thank you once again, Francesc!).

kotlin-compiler@1.2.30 hasn't been released yet so "An illegal reflective access operation has occurred" warning is still printed (to stderr) but other than that it appears to be working.

@shyiko
Copy link
Collaborator

shyiko commented Mar 1, 2018

ktlint@0.18.0 with kotlin-compiler@1.2.30 is out. Java 9 support is now official. Thanks everyone 🙇‍♂️

@shyiko shyiko closed this as completed Mar 1, 2018
@Baneeishaque
Copy link

what about jdk 11?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants