dkandalov / live-plugin

IntelliJ plugin for writing IntelliJ plugins at runtime ⚡️
https://plugins.jetbrains.com/plugin/7282
Apache License 2.0
858 stars 67 forks source link

Class Plugin overrides final method KotlinScriptTemplate.getProject() #107

Closed coodix closed 4 years ago

coodix commented 4 years ago

Example of Kotlin plugin:

import com.intellij.openapi.project.ProjectManager
val project = ProjectManager.getInstance()

Produced error:

Error while loading plugin class. java.lang.VerifyError: class Plugin overrides final method liveplugin.pluginrunner.kotlin.KotlinScriptTemplate.getProject()Lcom/intellij/openapi/project/Project;
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
    at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
    at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:702)
    at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:812)
    at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:800)
    at liveplugin.pluginrunner.kotlin.KotlinPluginRunner.runPlugin(KotlinPluginRunner.kt:97)
    at liveplugin.pluginrunner.RunPluginActionsKt$runWith$1.invoke(RunPluginActions.kt:91)
    at liveplugin.pluginrunner.RunPluginActionsKt$runWith$1.invoke(RunPluginActions.kt)
    at liveplugin.pluginrunner.BackgroundRunner$SingleThreadBackgroundRunner$run$1$1.run(RunPluginActions.kt:113)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:894)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
    at com.intellij.openapi.progress.impl.CoreProgressManager$4.run(CoreProgressManager.java:408)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

Reproduced in IDEA 2019.3

coodix commented 4 years ago

I see the problem is in using variable with name project.