Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

ktfmt 0.51 incompatible with Spotless Gradle plugin #483

Closed
sgrimm opened this issue Jun 14, 2024 · 2 comments
Closed

ktfmt 0.51 incompatible with Spotless Gradle plugin #483

sgrimm opened this issue Jun 14, 2024 · 2 comments

Comments

@sgrimm
Copy link
Contributor

sgrimm commented Jun 14, 2024

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.

@hick209
Copy link
Contributor

hick209 commented Jun 14, 2024

This should fix the issues diffplug/spotless#2172

@hick209 hick209 closed this as completed Jun 14, 2024
@hick209
Copy link
Contributor

hick209 commented Jun 18, 2024

FYI diffplug/spotless#2172 was just merged into Spotless

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

No branches or pull requests

2 participants