Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Schorn2010-01-04 09:14:15 +0000
committerMarkus Schorn2010-01-04 09:14:15 +0000
commit1d531b4d2f952a66171a46701d307040a974a256 (patch)
treea0f21021b5d3fc0ae6e90a23ad05c8b6bb9acf0d
parent1df18c902a4f969037d2df655fa215471d51e53a (diff)
downloadorg.eclipse.cdt-1d531b4d2f952a66171a46701d307040a974a256.tar.gz
org.eclipse.cdt-1d531b4d2f952a66171a46701d307040a974a256.tar.xz
org.eclipse.cdt-1d531b4d2f952a66171a46701d307040a974a256.zip
Bug 297641: Result cache of read-only fragments is not cleared.
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/EmptyIndexFragment.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java6
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java5
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/WritableCIndex.java3
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java2
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java4
6 files changed, 22 insertions, 1 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/EmptyIndexFragment.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/EmptyIndexFragment.java
index 78a6dbb3f8c..eb1aec237a2 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/EmptyIndexFragment.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/EmptyIndexFragment.java
@@ -139,4 +139,7 @@ public class EmptyIndexFragment implements IIndexFragment {
public Object putCachedResult(Object key, Object value, boolean replace) {
return value;
}
+
+ public void clearResultCache() {
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
index ccf7ce2011a..efb0fffdbcb 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/CIndex.java
@@ -617,6 +617,12 @@ public class CIndex implements IIndex {
}
}
+ void clearResultCaches() {
+ for (IIndexFragment frag : fFragments) {
+ frag.clearResultCache();
+ }
+ }
+
public IIndexFileSet createFileSet() {
return new IndexFileSet();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java
index 53676cf664f..d8634d3fed4 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/IIndexFragment.java
@@ -268,4 +268,9 @@ public interface IIndexFragment {
* longer holds a locks.
*/
Object getCachedResult(Object key);
+
+ /**
+ * Clears the result cache.
+ */
+ void clearResultCache();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/WritableCIndex.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/WritableCIndex.java
index 3efb8e4ce5a..551203eeebc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/WritableCIndex.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/index/WritableCIndex.java
@@ -125,6 +125,9 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
fIsWriteLocked= false;
fWritableFragment.releaseWriteLock(establishReadlockCount, flush);
+
+ // Bug 297641: Result cache of read only providers needs to be cleared.
+ clearResultCaches();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
index b2589d86541..3ea1168485f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOM.java
@@ -1144,7 +1144,7 @@ public class PDOM extends PlatformObject implements IPDOM {
clearResultCache();
}
- private void clearResultCache() {
+ public void clearResultCache() {
synchronized (fResultCache) {
fResultCache.clear();
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java
index 0b7218befba..e0d4208eb90 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/pdom/PDOMProxy.java
@@ -274,4 +274,8 @@ public class PDOMProxy implements IPDOM {
public Object putCachedResult(Object key, Object value, boolean replace) {
return value;
}
+ public void clearResultCache() {
+ if (fDelegate != null)
+ fDelegate.clearResultCache();
+ }
}

Back to the top