With the latest stable version (6.25.0) of the Spotless Gradle plugin, ktfmt 0.50 works but 0.51 fails with an error on ./gradlew spotlessApply:
com.facebook.ktfmt.format.FormattingOptions: method 'void <init>()' not found
java.lang.NoSuchMethodError: com.facebook.ktfmt.format.FormattingOptions: method 'void <init>()' not found
at com.diffplug.spotless.glue.ktfmt.KtfmtFormatterFunc.createFormattingOptions(KtfmtFormatterFunc.java:61)
at com.diffplug.spotless.glue.ktfmt.KtfmtFormatterFunc.apply(KtfmtFormatterFunc.java:54)
at com.diffplug.spotless.FormatterFunc.apply(FormatterFunc.java:32)
at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:82)
at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:103)
at com.diffplug.spotless.Formatter.compute(Formatter.java:246)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:203)
at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:190)
at com.diffplug.gradle.spotless.SpotlessTaskImpl.processInputFile(SpotlessTaskImpl.java:105)
at com.diffplug.gradle.spotless.SpotlessTaskImpl.performAction(SpotlessTaskImpl.java:89)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
I believe this is because commit 520706e added two arguments to FormattingOptions without default values, and Spotless is trying to call a no-arg constructor.
Not sure if this is something that needs to be fixed in ktfmt proper or in the Spotless ktfmt plugin; I've also filed diffplug/spotless#2171 on the Spotless side.
With the latest stable version (6.25.0) of the Spotless Gradle plugin, ktfmt 0.50 works but 0.51 fails with an error on
./gradlew spotlessApply:I believe this is because commit 520706e added two arguments to
FormattingOptionswithout default values, and Spotless is trying to call a no-arg constructor.Not sure if this is something that needs to be fixed in ktfmt proper or in the Spotless ktfmt plugin; I've also filed diffplug/spotless#2171 on the Spotless side.