Closed jeffdgr8 closed 10 months ago
yeah, it sounds like an IDE issue since I am using that fine at command-line. I guess open the issue with IDEA?
Thanks for the quick response @ben-manes. What version of Kotlin are you using in your code? Perhaps this is a regression in Kotlin 1.9?
Looks like you're using Kotlin 1.9.10. 🤔 Do you not see errors for this code in your IDE?
Gradle runs on 1.8.x until the next major release, iirc. I only know that because I get qodana warnings on 1.9 deprecations in the build files, but its not yet what Gradle runs as (and had found https://github.com/gradle/gradle/issues/25517#issue-1776410738 to understand why).
Looks like you're using Kotlin 1.9.10. 🤔 Do you not see errors for this code in your IDE?
I use Eclipse for development and VSCode for build files. Unfortunately IntelliJ goes into a death spiral when trying to edit kotlin build scripts so that it is faster to iterate in a text editor and cli than using their tooling. I kept trying when migrating to a kotlin build but it was unusable, not sure if that is the common experience or due to heavy build refactoring?
Unfortunately IntelliJ goes into a death spiral when trying to edit kotlin build scripts
Interesting, I haven't experienced that myself.
I just cloned caffeine and opened in IntelliJ and I don't see the same issue there. The variables and functions resolve and cmd+clicking traverses to the correct all()
overload.
I wonder what the difference could be with my project? I'm using Gradle 8.3 too. I'll open a YouTrack issue with JetBrains.
Closing as acknowledged by Jetbrains as a known regression (fixed for Gradle 8.4 iiuc).
The Gradle Kotlin DSL example in the readme:
doesn't work without an explicit argument name in the
all()
function call.As the code is written, Android Studio resolves
all { ... }
to the more generalall(ruleSource: Any)
, rather than the intendedall(selectionAction: Action<in ComponentSelectionWithCurrent>)
.Adding the named argument fixes the code:
This seems to be an IDE issue at its core, as the code runs successfully without the named arguments. But both Android Studio and IntelliJ IDEA both can't resolve the
candidate
andreject()
code and traverse to the incorrectall()
function when cmd+clicking.