From 4d4662fb9e33869d21f2141f3c8a7b3226ed50cd Mon Sep 17 00:00:00 2001 From: "Maxim.Mossienko" Date: Wed, 23 Nov 2011 10:27:52 +0400 Subject: [PATCH 1/2] rebuild index on IllegalStateException --- .../src/com/intellij/util/indexing/FileBasedIndex.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java index b587d056ad2d..ddd44b1fec11 100644 --- a/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java +++ b/platform/lang-impl/src/com/intellij/util/indexing/FileBasedIndex.java @@ -932,7 +932,8 @@ public class FileBasedIndex implements ApplicationComponent { public static @Nullable Throwable getCauseToRebuildIndex(RuntimeException e) { Throwable cause = e.getCause(); - if (cause instanceof StorageException || cause instanceof IOException || cause instanceof IllegalArgumentException) return cause; + if (cause instanceof StorageException || cause instanceof IOException || + cause instanceof IllegalArgumentException || cause instanceof IllegalStateException) return cause; return null; } From 0868ae10d9b3632d69dd158dcb045d92a5dfe025 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 23 Nov 2011 10:28:40 +0100 Subject: [PATCH 2/2] drop subtag cache on changes in non-physical files, should fix tests --- .../src/com/intellij/psi/impl/PsiCachedValue.java | 8 ++++++-- .../src/com/intellij/psi/impl/source/xml/XmlTagImpl.java | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiCachedValue.java b/platform/core-impl/src/com/intellij/psi/impl/PsiCachedValue.java index 63b1f02e988d..808a1cfcb7fc 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiCachedValue.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiCachedValue.java @@ -52,9 +52,13 @@ public abstract class PsiCachedValue extends CachedValueBase { @Override protected boolean isDependencyOutOfDate(Object dependency, long oldTimeStamp) { - return !(dependency instanceof PsiElement && myLastPsiTimeStamp == myManager.getModificationTracker().getModificationCount()) && - super.isDependencyOutOfDate(dependency, oldTimeStamp); + if (dependency instanceof PsiElement && + myLastPsiTimeStamp == myManager.getModificationTracker().getModificationCount() && + ((PsiElement)dependency).isPhysical()) { + return false; + } + return super.isDependencyOutOfDate(dependency, oldTimeStamp); } @Override diff --git a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java index e9493f197f39..fbe5ae568fa5 100644 --- a/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java +++ b/xml/impl/src/com/intellij/psi/impl/source/xml/XmlTagImpl.java @@ -615,7 +615,7 @@ public class XmlTagImpl extends XmlElementImpl implements XmlTag { final int s = result.size(); XmlTag[] tags = s > 0 ? ContainerUtil.toArray(result, new XmlTag[s]) : EMPTY; - return Result.create(tags, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT); + return Result.create(tags, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT, getContainingFile()); } });