-
-
Notifications
You must be signed in to change notification settings - Fork 772
Kotlin SAM overload resolution ambiguity between Consumer and ThrowingConsumer #2357
Copy link
Copy link
Open
Open
Copy link
Labels
language: KotlinAn issue related to using AssertJ with KotlinAn issue related to using AssertJ with Kotlin
Milestone
Description
Summary
When using AssertJ Core 3.21.0 from Kotlin, an overload resolution ambiguity occurrs for methods having overloads which accept both Consumer and ThrowingConsumer.
Methods affected (list noncomprehensive)
org.assertj.core.api.AbstractAssert#satisfies(java.util.function.Consumer<? super ACTUAL>)
org.assertj.core.api.ObjectEnumerableAssert#allSatisfy(org.assertj.core.api.ThrowingConsumer<? super ELEMENT>)
Example
Worked before (typical syntax for Kotlin calling a method which takes a functional interface AKA "SAM")
assertThat(bounds).satisfies { // worked pre-3.21.0
assertThat(it.startInclusive) // ... any detail assert statement
}Wordy workaround:
assertThat(bounds).satisfies(Consumer {
assertThat(it.startInclusive) // ... any detail assert statement
})This overload ambiguity is (also) an issue of kotlin language design, cf. KT-17765
References
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
language: KotlinAn issue related to using AssertJ with KotlinAn issue related to using AssertJ with Kotlin