question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrading from 9.3.0 to 9.4.0: ktlintCheck fails cause of java.lang.NoSuchFieldError: FUN_KEYWORD

See original GitHub issue

With the upgrade to version 9.4.0 the following exception is thrown with the stacktrace when executing the Gradle Task ktlintCheck:

Task :ktlintTestSourceSetCheck FAILED
Exception in thread "main" java.lang.NoSuchFieldError: FUN_KEYWORD
	at com.pinterest.ktlint.core.ast.ElementType.<clinit>(ElementType.kt:154)
	at com.pinterest.ktlint.ruleset.experimental.SpacingAroundAngleBracketsRule.<clinit>(SpacingAroundAngleBracketsRule.kt:94)
	at com.pinterest.ktlint.ruleset.experimental.ExperimentalRuleSetProvider.get(ExperimentalRuleSetProvider.kt:18)
	at com.pinterest.ktlint.KtlintCommandLine.loadRulesets(Main.kt:550)
	at com.pinterest.ktlint.KtlintCommandLine.run(Main.kt:222)
	at com.pinterest.ktlint.Main.main(Main.kt:62)

My Environment:

  • macOS Catalina Version 10.15.6
  • Java: openjdk version “14.0.2” 2020-07-14
  • Gradle: 6.1.1
  • IntelliJ IDEA 2020.2 (Ultimate Edition) Build #IU-202.6397.94, built on July 27, 2020

This issue occurs within IntelliJ and command line usage.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
theexiile1305commented, Sep 15, 2020

@Tapchicoma Thank you very much, upgrading all kotlin related stuff to version 1.4.10 solves the problem automatically.

0reactions
Tapchicomacommented, Sep 15, 2020

In your case it is id("io.spring.dependency-management") version "1.0.10.RELEASE" plugin that forces lower kotlin dependency for ktlint configuration. Commenting this plugin allows ktlint to run normally.

You could check which kotlin version is used via ./gradlew dependencies --configuration ktlint.

Unfortunately I am not familiar with spring dependency-management plugin to help you with ktlint configuration exclusion.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ktlintCheck task does not fail on Windows · Issue #399 - GitHub
Kotlin version 1.4.10; Ktlint-gradle plugin 9.4.0. The java --version output in the local and docker environment is the same:.
Read more >
kotlin - KtLint check doesn't work locally anymore
For no reason I am able to understand my gradle ktlintCheck command does not yield any issues anymore and :ktlintFormat is not fixing ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found