我正在开发一个IntelliJ插件,我在其中生成Builder模式。但是,由于名为PluginException的东西,我似乎无法使用该插件。我在与this post相同的五个步骤中重现了错误,因为没有回答,我决定在这个问题中给出一些代码示例(我不允许对另一个问题发表评论。这有很多也是这样做的。)
可以找到代码here。 test-plugin应该在当前类中生成一个带有getter的字段,以及一个新类型的内部类(NumberFactory)。我在安装插件后得到的堆栈跟踪如下:
*cannot create class "be.koen.wellens.MyBuilderGeneratorAction" [Plugin: be.koen.wellens]: cannot create class "be.koen.wellens.MyBuilderGeneratorAction" [Plugin: be.koen.wellens]
com.intellij.diagnostic.PluginException: cannot create class "be.koen.wellens.MyBuilderGeneratorAction" [Plugin: be.koen.wellens]
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:287)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:239)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:232)
at com.intellij.openapi.actionSystem.DefaultActionGroup.unStub(DefaultActionGroup.java:345)
at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:303)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1261)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1254)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:1254)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1248)
at com.intellij.codeInsight.generation.actions.GenerateAction.preload(GenerateAction.java:91)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:1266)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:1269)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1248)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.c(ActionManagerImpl.java:1236)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.access$200(ActionManagerImpl.java:73)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$4.run(ActionManagerImpl.java:1220)
at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)
Caused by: com.intellij.diagnostic.PluginException: be/koen/wellens/MyBuilderGeneratorAction : Unsupported major.minor version 51.0 [Plugin: be.koen.wellens]
at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:130)
at com.intellij.ide.plugins.cl.PluginClassLoader.a(PluginClassLoader.java:77)
at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:66)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:249)
at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:262)
... 24 more
Caused by: java.lang.UnsupportedClassVersionError: be/koen/wellens/MyBuilderGeneratorAction : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.lang.ClassLoader.defineClass(ClassLoader.java:471)
at com.intellij.util.lang.UrlClassLoader._defineClass(UrlClassLoader.java:195)
at com.intellij.util.lang.UrlClassLoader.defineClass(UrlClassLoader.java:191)
at com.intellij.util.lang.UrlClassLoader._findClass(UrlClassLoader.java:167)
at com.intellij.ide.plugins.cl.PluginClassLoader.b(PluginClassLoader.java:124)
... 30 more*
提前致谢!
柯恩
答案 0 :(得分:1)
Meo给出了答案(谢谢,Meo!)。我所要做的只是使用JDK 1.6 .. 如果只有生活中的所有事情都那么简单。 : - )
再一次,非常感谢!