Updating from .46 to .57 noticed the biggest chan...
# ktfmt
c
Updating from .46 to .57 noticed the biggest change was trailing commas... any way to opt out of them? 😅
j
Last version added a way to keep the old behavior
c
oh snap. let me take a look.
FormattingOptions.manageTrailingCommas was replaced with FormattingOptions.trailingCommaManagementStrategy
Hm. So i might be missing something basic here... but where do we set formatting options?
j
It depends on what you are using, I don’t know if all tools have been updated to support it, I doubt spotless has it yet as the release is older than the latest from ktfmt
> Dependency resolution is looking for a library compatible with JVM runtime version 11, but 'com.facebookktfmt0.57' is only compatible with JVM runtime version 17 or newer.
@Nivaldo H Bondança any reason ktfmt moved from Java 11 to 17?
c
ah yes. im using spotless
n
@Javier, none that I can remember other than our whole codebase being on JDK 17
j
@Nivaldo H Bondança Beside any breaking change not added to spotless, I think spotless uses JDK 11, so it could be a blocker, as I think Spotless has not updated ktfmt since it is 17.
As Gradle is moving to JDK 17 with Gradle 9, I don't know if the ecosystem will move to that version, including Spotless. Anyway, I think moving the Kotlin compile tasks to be Java 11 would be nice if it is not a problem for you.
n
I see no problem with moving back as long as nothing breaks, TBH
I can validate that later in the week, if you don't beat me to it
j
Nice, thank you!
n
@Javier, a super quick look here showed me that the only issue we have is with the idea plugin, which when I downgrade here to 11, gives out the follow compilation error message https://github.com/facebook/ktfmt/blob/main/gradle/libs.versions.toml#L2
Copy code
> Task :idea_plugin:compileKotlin FAILED
e: file:///Users/nbondanca/fbsource/xplat/ktfmt/ktfmt_idea_plugin/src/main/kotlin/com/facebook/ktfmt/intellij/KtfmtSettings.kt:144:38 Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 11. Specify proper '-jvm-target' option.
e: file:///Users/nbondanca/fbsource/xplat/ktfmt/ktfmt_idea_plugin/src/main/kotlin/com/facebook/ktfmt/intellij/KtfmtSettings.kt:145:47 Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 11. Specify proper '-jvm-target' option.

FAILURE: Build failed with an exception.
I don't have time to look further into this at the moment, but hopefully just splitting things up there should be enough to fix the issue.
j
I think the IDE plugin can be on JVM 17, as it is not used by spotless, wdyt?
👍 1
I will try to take a look into this, this week
It should be easy
n
FYI @GreyhairRedbear was also looking into this
Last comment on https://github.com/diffplug/spotless/issues/2602 says Spotless should work on JDK 17