Classloader Issues In Plugins

I have run into a couple different issues recently.

The major one is that my Lua plugin has (on the single language IDE's) begun to interact with the Javascript plugin such that they will not both load. You can only load Lua or JS not both. Each does work separately.

If the Lua plugin and JS plugin are both loaded I get an exception stack where the JS plugin is trying to load a class using the Lua plugin's classloader. This doesn't seem to happen in IDEA though - that might be a clue.

I opened a ticket, but I'm not sure it will get much attention since JS works without Lua running.

http://youtrack.jetbrains.net/issue/WI-9142

Next, I was trying to use Java serialization from my plugin during Stub deserialization,

In my PsiElement's constructor that takes a StubElement I was trying to deserialize a byte array which contained a serlialized java class. I couldn't deserialize it (NoClassDefFound exception). It seemed like this was occuring on a non-plugin classloader.

Is there a way to ensure that I am using the plugin classloader?

4 comments
Comment actions Permalink

As an aside. I was able to fix the problem I was having when using java serialization by subclassing ObjectInputStream and supplying the classloader from

PluginManager.getPlugin(PluginId.getId("Lua")).getPluginClassLoader();


I have no idea what could be happening with the Javascript plugin though.

0
Comment actions Permalink

I disabled the Lua plugin's implementation of LibraryType, and the JS plugin loads now. I really dont understand why though.

I still havent replaced the library creator which was removed in 11, so all my plugin type was doing is providing an icon.

Here is the source:

https://bitbucket.org/sylvanaar2/lua-for-idea/src/4e7c33767cd5/src/library/LuaLibraryType.java

0
Comment actions Permalink

The DownloadableLibraryTypeBase class is part of the IntelliJ IDEA specific codebase; it's not available in other IDEs based on the platform.

0
Comment actions Permalink

That makes sense. I don't understand why each plugin could load separately but not together though.

0

Please sign in to leave a comment.