Also, if you’re on Kotlin 1.4 it won’t work right ...
# ktfmt
g
Also, if you’re on Kotlin 1.4 it won’t work right now. I’ll release a new version later today. Due to how ktfmt loads the AST viewer, you also need to be on Gradle 6.8+ to make everything work 😓
j
This is the problem you talked about?
Copy code
Execution failed for task ':app:ktfmtFormatMainJavaSource'.
> class com.facebook.ktfmt.KotlinInputAstVisitor overrides final method org.jetbrains.kotlin.psi.KtVisitorVoid.visitCollectionLiteralExpression(Lorg/jetbrains/kotlin/psi/KtCollectionLiteralExpression;Ljava/lang/Void;)Ljava/lang/Void;
g
yeah, that happens if you try to format Kotlin 1.4.x code with the version
0.1.0
of the plugin.
j
The fix will be for 1.4.0 but Gradle 6.8 will be a requirement too?
g
Gradle 6.8 will be a requirement too?
As of today, yes. Gradle is embedding Kotlin 1.3.x in versions 6.7.x and below. They bumped the embedded Kotlin to 1.4.x on 6.8.x.
Hopefully 6.8 will be released stable asap. Now they’re at
-rc3
j
Yeah, no problem, is for updating some projects :)
g
Ideally, ktfmt should allow to inject the desired Kotlin version.
j
Yep
This problem will appear when Kotlin 1.5 is released and ktfmt starts to use it? Gradle takes months before releasing 1.4 support, this can be a problem if they keep this slow sync with Kotlin releases 🤔
g
It’s definitely a problem with the Gradle ecosystem: https://github.com/gradle/gradle/issues/12660
👍 1