esteinberg / plantuml4idea

Intellij IDEA plugin for PlantUML
Apache License 2.0
633 stars 113 forks source link

Update PlantUML to 1.2023.0 #375

Closed BenceSzalai closed 1 year ago

BenceSzalai commented 1 year ago

Hi! Title says it. I've tried to set up using custom .jar, but it is not working:

I am getting two errors ``` java.lang.NoClassDefFoundError: Could not initialize class org.plantuml.idea.adapter.rendering.PlantUmlRendererUtil at org.plantuml.idea.adapter.FacadeImpl.render(FacadeImpl.java:93) at org.plantuml.idea.AboutDialog.testDot(AboutDialog.java:123) at org.plantuml.idea.AboutDialog.(AboutDialog.java:58) at org.plantuml.idea.action.AboutAction.actionPerformed(AboutAction.java:15) at com.intellij.openapi.actionSystem.impl.ActionButton.actionPerformed(ActionButton.java:197) at com.intellij.openapi.actionSystem.impl.ActionButton.lambda$performAction$0(ActionButton.java:176) at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:346) at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:176) at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:465) at java.desktop/java.awt.Component.processEvent(Component.java:6413) at java.desktop/java.awt.Container.processEvent(Container.java:2266) at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516) at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310) at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802) at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754) at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:909) at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:831) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:753) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437) at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:772) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436) at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113) at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615) at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434) at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:813) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92) ``` and ``` Exception occurred rendering RenderCommand[hash=539975724,targets=[PlantUmlPreviewPanel[hash=1332974458, displayedItem=org.plantuml.idea.rendering.RenderCacheItem@5dba9bff[version=128,renderRequest=RenderRequest[sourceFilePath=/test.puml,format=SVG,page=-1,scaledZoom=Zoom[unscaledZoom=80,scaledZoom=80,displaySvg=true,systemScale=1.0],renderUrlLinks=true,reason=REFRESH,version=128,useSettings=true,disableSvgZoom=true],page=-1,imageResult=RenderResult[pages=1,rendered=1,updatedTitles=0,cached=0,diagrams=[ImageItem[format=SVG,filename=,page=0,description=ok,title=,imageBytes.length=98637]]],imagesWithData=[ImageItem[format=SVG,filename=,page=0,description=ok,title=,imageBytes.length=98637]]]]],reason=REFRESH,sourceFilePath=/test.puml,page=-1,scaledZoom=Zoom[unscaledZoom=80,scaledZoom=80,displaySvg=true,systemScale=1.0],cachedItem=,version=129] java.lang.ExceptionInInitializerError at org.plantuml.idea.adapter.FacadeImpl.render(FacadeImpl.java:93) at org.plantuml.idea.rendering.RenderCommand.render(RenderCommand.java:143) at org.plantuml.idea.rendering.LazyApplicationPoolExecutor$MyRunnable.run(LazyApplicationPoolExecutor.java:130) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: org.plantuml.idea.external.IncompatiblePlantUmlVersionException: net.sourceforge.plantuml.LineLocation not found in child classloader, and prohibited from loading from parent at org.plantuml.idea.external.ParentLastURLClassLoader$ChildURLClassLoader.findClass(ParentLastURLClassLoader.java:104) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at org.plantuml.idea.adapter.rendering.PlantUmlRendererUtil.(PlantUmlRendererUtil.java:25) ... 8 more Caused by: java.lang.ClassNotFoundException: net.sourceforge.plantuml.LineLocation at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445) at org.plantuml.idea.external.ParentLastURLClassLoader$ChildURLClassLoader.findClass(ParentLastURLClassLoader.java:91) ... 11 more ```

It is potentially due to incompatibility with new PlantUML version. I've tried to update from the bundled plantuml-1.2022.13.jar to plantuml-1.2022.14.jar which is working fine, but the preview fails with plantuml-1.2023.0.jar from here.

BenceSzalai commented 1 year ago

Investigating it looks like the problem may be that: net.sourceforge.plantuml.LineLocation is now called: net.sourceforge.plantuml.utils.LineLocation Related commit is https://github.com/plantuml/plantuml/commit/ec12ff5f1e46e5ff6968a274e55bc0e7d5fb00fb

Indeed there may be other classes relocated as well, I only see the first one missing. It worth taking a look at the https://github.com/plantuml/plantuml/tree/master/src/net/sourceforge/plantuml/utils folder, to see what else has been moved there from variety of other folders in the latest version.

krasa commented 1 year ago

Thanks, the update verification will take some time. You can use this: plantuml4idea.zip

BenceSzalai commented 1 year ago

Thank you very much for the quick reaction.

Oddly the zip you linked still bundles plantuml-1.2022.13.jar and gives error when manually pointed at plantuml-1.2023.0.jar. Maybe the compile did not take the fix into account?

PhpStorm shows the plugin version as 5.20, but under what's new it only lists changes up till 5.19, which is also odd considering that the commit contains an updated change-notes in plugin.xml.

UPDATE: I can see it should really be 5.21 now. But the zip contains 5.20. Also I see it's only a typo in the changelog that 5.20 was released written as 5.19, which is doubled.

krasa commented 1 year ago

Oops, something went wrong, this was an old build. Sorry.

You can now use IDE to update.

BenceSzalai commented 1 year ago

Cool! You are awesome! Thanks!

krasa commented 1 year ago

Thank you!