java.lang.VerifyError用kotlin创建一个gradle任务

我尝试用kotlin写一个gradle任务,这是我的代码:

GreetingTask.kt

class GreetingTask : DefaultTask() { @TaskAction fun greet() { println("greet!") } } 

的build.gradle

 buildscript { repositories { mavenCentral() } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.12.613" } } apply plugin: "kotlin" dependencies { compile "org.jetbrains.kotlin:kotlin-stdlib:0.12.613" compile gradleApi() } 

GreetingTaskTest

 class GreetingTaskTest { @Test public fun canAddTaskToProject() { val project = ProjectBuilder.builder().build() val task = project.task(hashMapOf("type" to javaClass()), "greeting") assertTrue(task is GreetingTask) } } 

现在运行测试的结果是:

 java.lang.VerifyError at GreetingTaskTest.kt:20 // reason -> Cannot inherit from final class 

这是哪一行:

 val task = project.task(hashMapOf("type" to javaClass()), "greeting") 

我想知道的是:

这个问题从哪里来,如何解决?

Kotlin language will be the best programming language for Android.