This message was deleted.
# plugin-development
s
This message was deleted.
a
It doesn't look like the property is a
Property<MyEnum>
https://github.com/KengoTODA/mcve-assign-extension-fun/blob/ac63a9dfa7bc40a82d17d23a6bbb7ca9780dec36/plugin/src/main/kotlin/com/example/MyTask.kt#L10, so the
assign()
extension function doesn't apply
☝️ 1
👀 1
v
Yep, confirmed, changing the task property to
Property<MyEnum>
makes the tests pass
I don't think you can make it work with a plain field, and it is anyway better practice to use lazy properties everywhere to be able to lazily wire things
k
Oops, very easy mistake… 😭 thanks for your help!
facing another problem if I add two
assign
extension for two enum classes:
Copy code
e: file:///Users/kengo/GitHub/spotbugs-gradle-plugin/src/main/kotlin/com/github/spotbugs/snom/Extensions.kt:5:1 Platform declaration clash: The following declarations have the same JVM signature (assign(Lorg/gradle/api/provider/Property;Ljava/lang/String;)V):
    inline fun <reified T : Confidence> Property<T>.assign(string: String): Unit defined in com.github.spotbugs.snom
    inline fun <reified T : Effort> Property<T>.assign(string: String): Unit defined in com.github.spotbugs.snom
e: file:///Users/kengo/GitHub/spotbugs-gradle-plugin/src/main/kotlin/com/github/spotbugs/snom/Extensions.kt:9:1 Platform declaration clash: The following declarations have the same JVM signature (assign(Lorg/gradle/api/provider/Property;Ljava/lang/String;)V):
    inline fun <reified T : Confidence> Property<T>.assign(string: String): Unit defined in com.github.spotbugs.snom
    inline fun <reified T : Effort> Property<T>.assign(string: String): Unit defined in com.github.spotbugs.snom
seems that I could resolve it by moving them into different namespace, e.g.
FirstEnum.Companion.assign
and
SecondEnum.Companion.assign
v
I think it should also work if you annotate one of them with
@JvmName
👀 1
plus1 1