jshiell / checkstyle-idea

CheckStyle plug-in for IntelliJ IDEA
https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
Other
888 stars 161 forks source link

IDEA 2016.3 Ultimate x64: Plugin crash on startup #278

Closed mmoayyed closed 7 years ago

mmoayyed commented 7 years ago

Running the latest version of the plugin, at random I see this error on startup:

Already disposed: Project (Disposed) cas-server
java.lang.AssertionError: Already disposed: Project (Disposed) cas-server
    at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:264)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.getPicoContainer(ComponentManagerImpl.java:58)
    at com.intellij.openapi.components.ServiceManager.doGetService(ServiceManager.java:48)
    at com.intellij.openapi.components.ServiceManager.getService(ServiceManager.java:43)
    at com.intellij.psi.codeStyle.CodeStyleSettingsManager.getInstance(CodeStyleSettingsManager.java:44)
    at org.infernus.idea.checkstyle.checker.Configurations.codeStyleSettingsManager(Configurations.java:70)
    at org.infernus.idea.checkstyle.checker.Configurations.currentCodeStyleSettings(Configurations.java:65)
    at org.infernus.idea.checkstyle.checker.Configurations.defaultTabSize(Configurations.java:60)
    at org.infernus.idea.checkstyle.checker.Configurations.tabWidth(Configurations.java:53)
    at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.createCreater(CheckerFactoryWorker.java:72)
    at org.infernus.idea.checkstyle.checker.CheckerFactoryWorker.run(CheckerFactoryWorker.java:56)

Project in question is https://github.com/apereo/cas

jshiell commented 7 years ago

Thanks for your report.

I'll have a look anon, however there may be a bit of a delay as I'm having building work done and the house is a bit of a bomb site.

It's curious though - the error suggests the project is being disposed of/still being created, so I'm not sure what exactly would be triggering the check. Most odd. Even more so given the CheckerFactory is a project level service, and so shouldn't exist when no project exists.

mmoayyed commented 7 years ago

Of course. Take your time please. Happy to resume testing and help out when/if this is patched.

jshiell commented 7 years ago

I fear I didn't manage to reproduce this with your project. But a bit more poking around in the code showed my initial analysis was wrong - the project is fine: it's the code style object lookup that's failing. So I've added a brute force workaround - for the tab size lookup we catch code style settings assertion errors and return a (moderately) sensible default. Hopefully this will help - if not, please reopen and I'll have another think. Thanks for your help!

mmoayyed commented 7 years ago

Excellent. Thank you very much. I did upgrade the plugin and will continue testing.