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
Fix KotlinProjectExtension.targets import on Kotlin 1.7.20 #5381
Conversation
detekt-gradle-plugin/src/main/kotlin/io/gitlab/arturbosch/detekt/internal/DetektJvm.kt
Outdated
Show resolved
Hide resolved
ba87fa2
to
faf099e
Compare
faf099e
to
d99c88d
Compare
Codecov Report
@@ Coverage Diff @@
## main #5381 +/- ##
============================================
+ Coverage 85.84% 86.11% +0.27%
+ Complexity 3722 3643 -79
============================================
Files 513 515 +2
Lines 12023 12085 +62
Branches 2227 2161 -66
============================================
+ Hits 10321 10407 +86
+ Misses 611 609 -2
+ Partials 1091 1069 -22
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@cortinico What will be the min Kotlin version requirement of Detekt 1.22, if it running under Kotlin 1.7.20, this PR would be a broken change? |
That's a non trivial question as it depends on the Kotlin version used by Gradle (as this is part of the Gradle plugin). I don't recall what's the status in the ecosystem, but we can't enforce 1.7.20 on all of our users. @3flex do you recall if this is safe to land or do we need to revert it? |
If not, I'll address a compatible commit with Goooler#3. |
I just see the declaration of // 1.7.10
val KotlinProjectExtension.targets: Iterable<KotlinTarget>
get() = when (this) {
is KotlinSingleTargetExtension -> listOf(this.target)
is KotlinMultiplatformExtension -> targets
else -> error("Unexpected 'kotlin' extension $this")
} to // 1.7.20
val KotlinProjectExtension.targets: Iterable<KotlinTarget>
get() = when (this) {
is KotlinSingleTargetExtension<*> -> listOf(this.target)
is KotlinMultiplatformExtension -> targets
else -> error("Unexpected 'kotlin' extension $this")
} there is an type argument added on abstract class KotlinSingleTargetExtension<TARGET : KotlinTarget>(project: Project) : KotlinProjectExtension(project) {
abstract val target: TARGET
fun target(body: Action<TARGET>) = body.execute(target)
} |
We can fix this broken change like Goooler@bb81a27? |
And the other solution is using |
I had a look at this and there's no need to use that function there. So I've opened #5383 to remove it which should avoid any compatibility issues. |
See #5163 (comment)