Custom language dynamic plugin unload failed because of the ImageDataByPathResourceLoader
I'm now working on a custom language plugin, just registered a file type and file icon, following the tutorial [Custom Language Support Tutorial-2. Language and File Type](https://plugins.jetbrains.com/docs/intellij/language-and-filetype.html#register-the-file-type).
Dynamic Plugin seems not working if I unload my plugin. I'v followed the throubleshooting and found that it's because of the ImageDataByPathResourceLoader, but I don't know how to resolve this.
Here is how I defined my file icon:
public static final Icon FILE = IconLoader.getIcon("/icons/file.svg", MyIcons.class);
I tried to remove the file icon and return null in my LanguageFileType#getIcon() method, after that dynamic plugin works fine.
My idea version: Idea community 2025.1.4.1
Platform Version: IC-2025.1
Below is my idea.log file:
2025-07-27 16:29:41,797 [ 48930] INFO - #c.i.i.p.DynamicPlugins - Snapshot analysis result: Root 1:
ROOT: Global JNI
(root): com.intellij.openapi.wm.impl.IdeFrameImpl
inputContext: sun.awt.im.InputMethodContext
currentClientComponent: com.intellij.ide.projectView.impl.ProjectViewPane$MyProjectViewTree
treeModel: com.intellij.ui.tree.AsyncTreeModel
tree: com.intellij.ui.tree.AsyncTreeModel$Tree
map: java.util.HashMap
table: java.util.HashMap$Node[]
[]: java.util.HashMap$Node
key: com.intellij.ui.tree.StructureTreeModel$Node
userObject: com.intellij.ide.projectView.impl.nodes.PsiFileNode
myClosedIcon: com.intellij.ui.RowIcon
icons: javax.swing.Icon[]
[]: com.intellij.ui.icons.CachedImageIcon
originalLoader: com.intellij.ui.icons.ImageDataByPathResourceLoader
* classLoader: com.intellij.ide.plugins.cl.PluginClassLoader
2025-07-27 16:29:41,807 [ 48940] INFO - #c.i.i.p.DynamicPlugins - Plugin xx is not unload-safe because class loader cannot be unloaded. Memory snapshot created at D:\Users\xx/unload-xx-27.07.2025_16.29.36.hprof
Please sign in to leave a comment.