mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
IDEA-255874 DOM: Drop DomUtil reflection caches on plugin unload
GitOrigin-RevId: 059900d80cfaa1061ecd9b94137fed3420101dc6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
acd72e6cdd
commit
172633e751
@@ -2,6 +2,8 @@
|
||||
package com.intellij.util.xml.impl;
|
||||
|
||||
import com.intellij.ide.highlighter.DomSupportEnabled;
|
||||
import com.intellij.ide.plugins.DynamicPluginListener;
|
||||
import com.intellij.ide.plugins.IdeaPluginDescriptor;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileTypes.FileTypeRegistry;
|
||||
@@ -60,7 +62,7 @@ import java.util.*;
|
||||
/**
|
||||
* @author peter
|
||||
*/
|
||||
public final class DomManagerImpl extends DomManager {
|
||||
public final class DomManagerImpl extends DomManager implements Disposable {
|
||||
private static final Key<Object> MOCK = Key.create("MockElement");
|
||||
|
||||
static final Key<WeakReference<DomFileElementImpl<?>>> CACHED_FILE_ELEMENT = Key.create("CACHED_FILE_ELEMENT");
|
||||
@@ -105,7 +107,7 @@ public final class DomManagerImpl extends DomManager {
|
||||
public boolean isAspectChangeInteresting(@NotNull PomModelAspect aspect) {
|
||||
return aspect instanceof TreeAspect;
|
||||
}
|
||||
}, project);
|
||||
}, this);
|
||||
|
||||
VirtualFileManager.getInstance().addAsyncFileListener(new AsyncFileListener() {
|
||||
@Nullable
|
||||
@@ -134,9 +136,19 @@ public final class DomManagerImpl extends DomManager {
|
||||
}
|
||||
return event instanceof VFileMoveEvent || event instanceof VFileDeleteEvent;
|
||||
}
|
||||
}, myProject);
|
||||
}, this);
|
||||
|
||||
project.getMessageBus().connect(this).subscribe(DynamicPluginListener.TOPIC, new DynamicPluginListener() {
|
||||
@Override
|
||||
public void beforePluginUnload(@NotNull IdeaPluginDescriptor pluginDescriptor, boolean isUpdate) {
|
||||
DomUtil.clearCaches();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() { }
|
||||
|
||||
public long getPsiModificationCount() {
|
||||
return PsiManager.getInstance(getProject()).getModificationTracker().getModificationCount();
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.util.containers.ConcurrentFactoryMap;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xml.reflect.*;
|
||||
import com.intellij.xml.util.XmlTagUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -147,6 +148,12 @@ public class DomUtil {
|
||||
return aClass == DUMMY ? null : aClass;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static void clearCaches() {
|
||||
ourTypeParameters.clear();
|
||||
ourVariableSubstitutions.clear();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static XmlElement getValueElement(GenericDomValue<?> domValue) {
|
||||
if (domValue instanceof GenericAttributeValue) {
|
||||
|
||||
Reference in New Issue
Block a user