phpinspectionsea icon indicating copy to clipboard operation
phpinspectionsea copied to clipboard

Exception on 2022.1

Open maicol07 opened this issue 2 years ago • 17 comments

Subject Details
Plugin Php Inspections (EA Ultimate) 2021.5
Language level PHP 8.0

Current behaviour

java.lang.IllegalStateException: You must not register toolwindow programmatically so early. Rework code or use ToolWindowManager.invokeLater
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.getToolWindowPaneIfInitialized(ToolWindowManagerImpl.kt:464)
	at com.intellij.openapi.wm.impl.ToolWindowManagerImpl.registerToolWindow(ToolWindowManagerImpl.kt:900)
	at com.jetbrains.rdserver.toolWindow.BackendServerToolWindowManager.registerToolWindow(BackendServerToolWindowManager.kt:87)
	at com.intellij.openapi.wm.ToolWindowManager.registerToolWindow(ToolWindowManager.kt:36)
	at com.kalessil.phpStorm.phpInspectionsEA.EAUltimateSidebarComponent.projectOpened(EAUltimateSidebarComponent.java:48)
	at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$executeInEdtWithProgress$1$1$lambda$1.invoke(ProjectManagerExImpl.kt:503)
	at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$executeInEdtWithProgress$1$1$lambda$1.invoke(ProjectManagerExImpl.kt)
	at com.intellij.serviceContainer.ComponentManagerImpl.processInitializedComponents(ComponentManagerImpl.kt:1324)
	at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$executeInEdtWithProgress$1$1.run(ProjectManagerExImpl.kt:611)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:607)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:681)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:629)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:606)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
	at com.intellij.openapi.project.impl.ProjectManagerExImplKt$openProject$$inlined$executeInEdtWithProgress$1.run(ProjectManagerExImpl.kt:460)
	at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:215)
	at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
	at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:197)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:511)
	at com.intellij.openapi.application.impl.LaterInvocator$1.run(LaterInvocator.java:96)
	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:69)
	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:112)
	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:42)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:875)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:740)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:433)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:801)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:432)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:598)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:430)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:873)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:478)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	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)

Expected behaviour

No exception

Environment details

PhpStorm 2022.1 EAP
Build #PS-221.3427.92, built on January 27, 2022
PhpStorm EAP User
Expiration date: February 26, 2022
Runtime version: 11.0.13+8-b1890.4 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11 10.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 16
Registry:
    run.processes.with.pty=TRUE
    ide.balloon.shadow.size=0

Non-Bundled Plugins:
    org.sonarlint.idea (6.4.3.42541)
    net.codestats.plugin.atom.intellij (1.0.9)
    intellij.webp (221.3427.87)
    foundation (1.3)
    eu.osimowicz.plugins.intellij.CodeBlocksSorter (0.1.2)
    commit-message-helper-idea-plugin (1.1.0)
    com.xiaobing1024.laravel (1.1.1)
    com.vexus2.intellij.openingithub (1.0.6)
    com.shuzijun.markdown-editor (1.12)
    com.sburlyaev.terminal.plugin (0.4.4)
    com.renemaas.intellij.zipper (1.1.0)
    com.obroom.plugin.toolset (2021.7.1)
    com.obroom.plugin.smartsearch (2021.7.1)
    com.jsonts.kotlin (1.0.12)
    com.jetbrains.plugins.code-notes-plugin (1.3)
    com.ivanovych666.intellij.plugin.jsonsorter (1.0.0-beta.3.4)
    com.intellij.ideolog (203.0.27.0)
    org.jetbrains.plugins.stylus (221.3427.87)
    org.intellij.plugins.postcss (221.3427.87)
    com.github.copilot (1.1.7.363)
    com.github.b3er.idea.plugins.arc.browser (0.23)
    cn.yiiguxing.plugin.md.palette (1.4)
    cn.alanhe.plugin.viewPackageVersions (1.2.0)
    com.intellij.plugin.adernov.powershell (2.0.9)
    String Manipulation (8.25.203.5981.1)
    Statistic (4.1.7)
    Quick Notes (3.3)
    uk.co.ben-gibson.remote.repository.mapper (3.3.6)
    intellij.prettierJS (221.3427.87)
    com.starzec.piotr (1.7.1)
    com.intellij.plugins.html.instantEditing (221.3427.87)
    org.endpointdeps.EndpointDependencies (1.3)
    net.king2500.plugins.PhpAdvancedAutoComplete (1.1.0)
    com.niclas-van-eyk.laravel-make-integration (2.3.5)
    com.kalessil.phpStorm.phpInspectionsUltimate-mp (2021.5)
    de.espend.idea.php.toolbox (6.0.0)
    de.espend.idea.php.annotation (8.0.0)
    dev.nybroe.collector (0.3.5)
    com.funivan.idea.phpClean (2021.09.26)
    lv.midiana.misc.phpstorm-plugins.deep-keys (2021.07.18.002)
    lv.midiana.misc.idea-plugins.deep-js-completion (2021.04.21.002)
    com.github.shiraji.yaemoji (1.0.8)
    com.almightyalpaca.intellij.plugins.discord (1.8.0)
    pro.bashsupport (3.0.0.221-beta3-eap)

maicol07 avatar Jan 31 '22 11:01 maicol07

Can also confirm the report for Phpstorm EAP 2022.1, just a different language level: PHP 7.4 - but I guess this makes not much of a difference.

/E: if it helps, I'd also install from an EAP channel of this Php Inspections EA plugin if available. Doing this for example with the ASCIIDoc plugin https://plugins.jetbrains.com/plugins/list?channel=eap&pluginId=7391

ktomk avatar Feb 10 '22 08:02 ktomk

+1 on this one; would love to try out 2022.1 EAP

tlamy avatar Feb 21 '22 12:02 tlamy

If time is crucial, you may just get rid of the sidebar tab, as the plugin still works (just without the tool window), you can just not choose the error level

tlamy avatar Apr 08 '22 06:04 tlamy

With the 2022.1 release now in general availability, are there any updates on this?

erikdebruin avatar Apr 20 '22 06:04 erikdebruin

It's a bit ridiculous. If serious errors are not fixed in time, I will request a refund for the EA Ultimate license.

kaliberx avatar Apr 20 '22 06:04 kaliberx

@kaliberx While it may be annoying, the only thing not working is the toolbar element. The rest works just fine. I don't know about you but I for example hardly ever (read: never after an initial look) open that toolbar panel. Just disable / remove it, and you won't have a "crash".

theseer avatar Apr 21 '22 12:04 theseer

@theseer How exactly do you "disable / remove it"?

laurinkeithdavis avatar Apr 21 '22 12:04 laurinkeithdavis

As the problematic call happens at startup, the registration call has to be avoided, meaning we have to remove it from the manifest (plugin.xml).

Maybe bit hacky, but actually not hard:

  • Stop all instances of PHPStorm
  • Locate the .jar containing the plugin, e.g. PhpInspectionsUltimate-mp.jar; In Linux this is ~/.local/share/JetBrains/PhpStorm2022.1
  • As jars are just ZIP files with some meta data included, open it in a tool of your choice that can edit files in it; in worst case just extract it fully
  • Locate META-INF/plugin.xml, open in editor
  • At the end of that file you find:
<component>
     <implementation-class>com.kalessil.phpStorm.phpInspectionsEA.EAUltimateSidebarComponent</implementation-class>
</component>
  • Remove these 3 lines
  • Save file
  • In case you extracted the jar completely before, repack it now
  • Start PHPStorm -> Crash error gone

Keep in mind that doesn't fix the underlying issue ;) It just removes the problematic toolbar registration process from happening.

theseer avatar Apr 21 '22 13:04 theseer

How can you recreate the jar file with macOS? If I use a renamed zip, the file isn't recognized any-more by PHPStorm.

COil avatar May 12 '22 20:05 COil

what @theseer wrote above (thanks!), here as one-liner for linux/unix shell with what a php developer most likely has already on the system: php + simplexml + zip-archive.

php -r '$p="META-INF/plugin.xml";$z=new ZipArchive;$z->open($argv[1]);$b=$z->getFromName($po="$p~")?:[$z->renameName($p, $po), $z->getFromName($po)][1];$z->deleteName($p);$n=($x=simplexml_load_string($b))->xpath("//component[contains(implementation-class,\".EAUltimateSidebarComponent\")]");unset($n[0][0]);$z->addFromString($p,$x->asXML());' PhpInspectionsUltimate-mp.jar

the last parameter is the path to the jar file:

  • in the same directory: PhpInspectionsUltimate-mp.jar
  • on my linux box: ~/.local/share/JetBrains/PhpStorm2022.1/PhpInspectionsUltimate-mp.jar

the one-liner makes a copy of the original file in the jar: META-INF/plugin.xml~ at the first run.

Keep in mind that doesn't fix the underlying issue ;) It just removes the problematic toolbar registration process from happening. (ref)

ktomk avatar May 13 '22 14:05 ktomk

Thanks @ktomk, just tested the snippet, and it works perfectly. Brilliant! 👏

The most difficult is perhaps to find the path, if it can help other macOS users (the space must be espaced) :

/Users/coil/Library/Application Support/JetBrains/PhpStorm2022.2/plugins

COil avatar May 13 '22 18:05 COil

On Windows (installed through JB Toolbox), the path is %USERPROFILE%\AppData\Local\JetBrains\Toolbox\apps\PhpStorm\ch-0\221.5591.58.plugins

dehrk avatar May 13 '22 19:05 dehrk

An additional note, on my Mac M1, I have a warning that a file is missing for the arm64e architecture, but the plugin still work. So, I just ignore it.

COil avatar May 18 '22 05:05 COil

For thoses who work with Toolbox App: https://asciinema.org/a/496881

~/local/share/JetBrains/Toolbox/apps/PhpStorm/ch-0/221.5591.58.plugins/PhpInspectionsUltimate-mp.jar 

roukmoute avatar May 24 '22 14:05 roukmoute

@kalessil any update on this? Every time I onboard a new developer and get them set up with this plugin, I have to explain that they should ignore this error on every app launch. It doesn't engender confidence in the tools.

I'm a long-time user and fan of this tool. I have been a paying customer since the Patreon days. I'd really like to see this addressed. Thank you!

Update: Shortly after my original comment, I found the fix detailed here which silenced the error as claimed. However, as the fix's author notes, this only suppresses the error without actually resolving the underlying bug. Additionally, I will now need to do this every time I onboard a new developer which will continue to foster skepticism.

huebs avatar Jul 18 '22 10:07 huebs

Everything indicates that the project is dead since the beginning of this year. In my opinion, it is not worth buying a subscription.

gander avatar Jul 18 '22 12:07 gander

No fix within one year is very said. I have canceled my subscription right now.

NeoBlack avatar Jan 10 '23 22:01 NeoBlack