Hey folks, I'm updating our projects to Kotlin 2.2...
# detekt
a
Hey folks, I'm updating our projects to Kotlin 2.2.0 and detekt appears to be fairly incompatible. I'm getting lots of false
UnusedPrivateMember
and
NullableToStringCall
errors, and a few ISEs:
Copy code
> A failure occurred while executing io.gitlab.arturbosch.detekt.invoke.DetektWorkAction
   > java.lang.IllegalStateException: Analyzing something.kt led to an exception.
     Location: java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
     The original exception message was: java.lang.NullPointerException
     Running detekt '1.23.8' on Java '21.0.6+-13391695-b895.109' on OS 'Mac OS X'
     If the exception message does not help, please feel free to create an issue on our GitHub page.
Given this PR is still draft, is this to be expected?
A related bit: the Kotlin 2.1.0 PR was merged last year but still isn't out even in alpha. https://github.com/detekt/detekt/pull/7805
b
On my project we have kotlin 2.2 and detkt still works fine. That said, it's perfectly possible that other projects start to see issues because the syntax of kotlin is changing. The last stable version of detekt is compiled against doesn't know about those new features (context parameters, for example)
We are still not ready to make our API stable so we can't release 2.0 yet. But we could start publishing alphas or betas.
Also we publish SNAPSHOTs that you could try
About the 2.2.0 PR I hope we merge it soon.
I just open this discussion. Feel free to share your opinion there: https://github.com/detekt/detekt/discussions/8299
👍 1
a
Thanks Brais. Alphas would be good, betas would be great. I'm reluctant to use snapshots because of their inherent mutability.
g
Yes we should start doing alphas. The problem is that we're still not done with shipping breaking changes, so they will also be unstable to some extent. As @Brais Gabin mentioned, you should be able to use the latest stable of Detekt with Kotlin 2.2 though. If not, please open an issue
a
Thanks. 2.2 broke Detekt on both our main repos. I'll try and create a simple repro to confirm whether it's something in our setup or a Detekt issue
g
Are you on a Spring project?
a
No, Android.
n
What are the odds of a 1.23.9 or a alpha release coming in the near future? Currently waiting on this fix as upgrading to Kotlin 2.2.0 broke a bunch of tests for our custom detekt rules
g
The 1.x branch is really challenge to release from, because of how far 2.x went. I'll see if we can release a patch with only Kotlin 2.2 though
n
Understood, thank you Nicola!
g
I’ll see what can be done. Maybe we can give it another try
thank you frog 2
a
https://kotlinlang.slack.com/archives/C88E12QH4/p1752786087693319?thread_ts=1752513467.904479&cid=C88E12QH4 @gammax Sorry about the nudge. Is there any idea about practicality of a patch on 1.x with Kotlin 2.2 support?
n
I assumed based on this post we weren't getting anything for 1.29.x
g
Sorry 1.x patch with 2.2 is unrealistic. We would have to drop the ktlint integration on 1.x branch for that to work, which we probably don't want to do. I'm working on shipping
2.0.0-alpha.0
❤️ 2
spiderman pointing 1
which will be built against Kotlin 2.2.0
We need to change all the maven coordinates also because of changes in the publishing plugins, so it's going to take a little longer. I hope to have it out in the next days/weeks.
👍 1
thank you frog 2
150 Views