Skip to content
This repository was archived by the owner on Dec 3, 2025. It is now read-only.
This repository was archived by the owner on Dec 3, 2025. It is now read-only.

Custom kotlin plugin error: loader constraint violation #84

@Evgen1000end

Description

@Evgen1000end

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?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions