ksprojects / protobuf-jetbrains-plugin

Protobuf Support for JetBrains IDEs
https://plugins.jetbrains.com/plugin/8277
Apache License 2.0
259 stars 46 forks source link

Exception thrown with Intellij EAP 2018.3 #120

Closed IceMan81 closed 5 years ago

IceMan81 commented 5 years ago

Describe the bug The plugin throws an exception java.lang.IncompatibleClassChangeError

To Reproduce Steps to reproduce the behavior:

  1. Use the latest version of the plugin with 2018.3 EAP
  2. Intellij throws IDE Fatal Errors

Expected behavior No exceptions from the plugin

Plugin (please complete the following information):

Additional context This is the full stack trace

io.protostuff.jetbrains.plugin.ProtostuffPluginController@22353110

java.lang.IncompatibleClassChangeError: Method com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable.getInstance(Lcom/intellij/openapi/project/Project;)Lcom/intellij/openapi/roots/libraries/LibraryTable; must be InterfaceMethodref 
    at io.protostuff.jetbrains.plugin.ProtostuffPluginController.findGlobalProtobufLibrary(ProtostuffPluginController.java:171)
    at io.protostuff.jetbrains.plugin.ProtostuffPluginController.updateGlobalLibrary(ProtostuffPluginController.java:140)
    at io.protostuff.jetbrains.plugin.ProtostuffPluginController.projectOpened(ProtostuffPluginController.java:87)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.fireProjectOpened(ProjectManagerImpl.java:793)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.lambda$null$6(ProjectManagerImpl.java:399)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransactionAndWait$2(TransactionGuardImpl.java:165)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.doRun(LaterInvocator.java:435)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:419)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:403)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:723)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:719)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:668)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:363)
    at com.intellij.ide.IdeEventQueue.pumpEventsForHierarchy(IdeEventQueue.java:776)
    at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:202)
    at com.intellij.openapi.progress.util.ProgressWindow.startBlocking(ProgressWindow.java:188)
    at com.intellij.openapi.application.impl.ApplicationImpl.runProcessWithProgressSynchronously(ApplicationImpl.java:606)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:454)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.runProcessWithProgressSynchronously(ProgressManagerImpl.java:110)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:251)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcessWithProgressSynchronously(CoreProgressManager.java:205)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.loadProjectUnderProgress(ProjectManagerImpl.java:448)
    at com.intellij.openapi.project.impl.ProjectManagerImpl.openProject(ProjectManagerImpl.java:423)
    at com.intellij.platform.PlatformProjectOpenProcessor.doOpenProject(PlatformProjectOpenProcessor.java:254)
    at com.intellij.ide.RecentProjectsManagerBase.doOpenProject(RecentProjectsManagerBase.java:578)
    at com.intellij.ide.RecentProjectsManagerBase.doReopenLastProject(RecentProjectsManagerBase.java:697)
    at com.intellij.ide.RecentProjectsManagerBase$MyAppLifecycleListener.appStarting(RecentProjectsManagerBase.java:742)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:564)
    at com.intellij.util.messages.impl.MessageBusConnectionImpl.deliverMessage(MessageBusConnectionImpl.java:117)
    at com.intellij.util.messages.impl.MessageBusImpl.doPumpMessages(MessageBusImpl.java:397)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpWaitingBuses(MessageBusImpl.java:358)
    at com.intellij.util.messages.impl.MessageBusImpl.pumpMessages(MessageBusImpl.java:347)
    at com.intellij.util.messages.impl.MessageBusImpl.sendMessage(MessageBusImpl.java:324)
    at com.intellij.util.messages.impl.MessageBusImpl.access$200(MessageBusImpl.java:29)
    at com.intellij.util.messages.impl.MessageBusImpl$2.invoke(MessageBusImpl.java:196)
    at com.sun.proxy.$Proxy67.appStarting(Unknown Source)
    at com.intellij.idea.IdeaApplication$IdeStarter.lambda$main$1(IdeaApplication.java:372)
    at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88)
    at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111)
    at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120)
    at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122)
    at com.intellij.idea.IdeaApplication$IdeStarter.main(IdeaApplication.java:370)
    at com.intellij.idea.IdeaApplication.lambda$run$1(IdeaApplication.java:211)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
    at com.intellij.idea.IdeaApplication.run(IdeaApplication.java:211)
    at com.intellij.idea.IdeaApplication.lambda$initApplication$0(IdeaApplication.java:74)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
    at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:98)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:723)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:342)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)`
kshchepanovskyi commented 5 years ago

Thank you for reporting this, I'll take a look as soon as possible.

kshchepanovskyi commented 5 years ago

@IceMan81 which EAP build did you use? I tested plugin with IC-183.3647.12, works fine.

IceMan81 commented 5 years ago

That's the same build I used, except that its the ultimate edition. I'm also using https://bintray.com/jetbrains/intellij-jdk/openjdk9-osx-x64/152 as the runtime JVM

kshchepanovskyi commented 5 years ago

Ok, I used JDK 8. That's why I could not reproduce it.

kshchepanovskyi commented 5 years ago

Until this bug is not fixed - you can run IDEA using JDK 8 as a workaround.

IceMan81 commented 5 years ago

Thanks for checking. From the exception hard to understand why that error would be because of JDK 9. I'll raise the error with Jetbrains.

IceMan81 commented 5 years ago

Jetbrains claims its a plugin issue : linking the issue I raised on YouTrack, https://youtrack.jetbrains.com/issue/IDEA-200883

kshchepanovskyi commented 5 years ago

Found a solution. It can be solved by recompiling plugin with IDEA 2018.3 (EAP) sources (previously it was 2018.2.1). Problem is with this method:

java.lang.IncompatibleClassChangeError: Method com.intellij.openapi.roots.impl.libraries.ProjectLibraryTable.getInstance(Lcom/intellij/openapi/project/Project;)Lcom/intellij/openapi/roots/libraries/LibraryTable; must be InterfaceMethodref

It was a static method of a class in 2018.2, in 2018.3 class become an interface. As a result, JVM throws an error - probably valid one.

@Yaroslav Bedrov can you please take a better look at it, I can solve this issue in my plugin, but most likely other plugins are also affected and will require changes too (and it's not very obvious what to do).

Waiting for JetBrains reply - https://youtrack.jetbrains.com/issue/IDEA-200883#focus=streamItem-27-3156826-0-0

kshchepanovskyi commented 5 years ago

https://youtrack.jetbrains.com/issue/IDEA-202322

kshchepanovskyi commented 5 years ago

Fixed by https://github.com/protostuff/protobuf-jetbrains-plugin/commit/5267b4632216e8e92b1dc5178d78f2fa2763d626

IceMan81 commented 5 years ago

Will you be releasing a new build with this fix? I tried to build it on my own but ran into some issues. Didn't try too hard to resolve them.

kshchepanovskyi commented 5 years ago

Yes, soon when this scope is ready: https://github.com/protostuff/protobuf-jetbrains-plugin/milestone/17

While it's not ready, you might want to use latest plugin build from here: https://jenkins.ksprojects.org/job/protostuff/job/protobuf-jetbrains-plugin/job/master/

IceMan81 commented 5 years ago

@kshchepanovskyi Thanks, that helped.