i wrote plugin on Kotlin and i'm trying use it.
Plugin:
open class ExampleTask: DefaultTask() {
var from:String = "default from value"
open fun lambdaExample(setup:(String)->String):String{
return setup(from)
}
@TaskAction
open fun send(){
val res = lambdaExample { "it = $it" }
println(res)
}
}
Call:
task < ExampleTask > ("overriding task"){
from = "new value"
val res = lambdaExample { "[$it]" }
}
Script not compile with error
Loader constraint violation: when resolving method "com.home.ExampleTask.lambdaExample(Lkotlin/jvm/functions/Function1;)Ljava/lang/String;" the class loader (instance of org/jetbrains/kotlin/codegen/GeneratedClassLoader) of the current class, Build_gradle$4, and the class loader (instance of org/gradle/internal/classloader/VisitableURLClassLoader) for the method's defining class, com.home.ExampleTask, have different Class objects for the type kotlin/jvm/functions/Function1 used in the signature
What am I doing wrong?