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

Spotless Gradle 6.23.2: Cannot access 'configure': it is private in 'ConfigurableStyle' #1921

Closed
3 tasks done
Komdosh opened this issue Dec 1, 2023 · 3 comments · Fixed by #1926
Closed
3 tasks done

Comments

@Komdosh
Copy link

Komdosh commented Dec 1, 2023

After update from 6.22.0 to 6.23.2 can't configure ktfmt style.

ktfmt().kotlinlangStyle().configure {
    it.setMaxWidth(120)
    it.setRemoveUnusedImport(true)
}

Error:

e: file:///project/build.gradle.kts:233:26: Cannot access 'configure': it is private in 'ConfigurableStyle'

In 6.23.0 there was a problem with private BaseKotlinConfigure (changed from 6.22.0). In 6.23.2 - BaseKotlinConfigure is public now. But method configure is still private in KtfmtConfig.

public class ConfigurableStyle {
  private void configure(Consumer<KtfmtStep.KtfmtFormattingOptions> optionsConfiguration) {
            KtfmtStep.KtfmtFormattingOptions ktfmtFormattingOptions = new KtfmtStep.KtfmtFormattingOptions();
            optionsConfiguration.accept(ktfmtFormattingOptions);
            options = ktfmtFormattingOptions;
            replaceStep(createStep());
  }
}

Spotless Gradle version is 6.23.2.

If you are submitting a bug, please include the following:

  • summary of problem
  • Gradle or Maven version
  • spotless version
  • operating system and version
  • copy-paste your full Spotless configuration block(s), and a link to a public git repo that reproduces the problem if possible
  • copy-paste the full content of any console errors emitted by gradlew spotless[Apply/Check] --stacktrace
@runenielsen
Copy link

I have the same problem.

@Goooler
Copy link
Member

Goooler commented Dec 2, 2023

Fixing this in #1926.

@Goooler
Copy link
Member

Goooler commented Dec 2, 2023

Workaround:

  ktfmt().withGroovyBuilder {
    """
      kotlinlangStyle().configure {
          it.setMaxWidth(120)
          it.setRemoveUnusedImport(true)
      }
    """.trimIndent()
  }

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

Successfully merging a pull request may close this issue.

3 participants