Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'core/org.eclipse.cdt.core')
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java
index 80a20e97e75..1e7b1d279b9 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/ASTTranslationUnit.java
@@ -95,8 +95,18 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
private IBuiltinBindingsProvider fBuiltinBindingsProvider;
// Caches
- private final WeakHashMap<IType, String> fUnnormalizedTypeStringCache = new WeakHashMap<>();
- private final WeakHashMap<IType, String> fNormalizedTypeStringCache = new WeakHashMap<>();
+ private final ThreadLocal<WeakHashMap<IType, String>> fUnnormalizedTypeStringCache = new ThreadLocal<WeakHashMap<IType, String>>() {
+ @Override
+ protected WeakHashMap<IType, String> initialValue() {
+ return new WeakHashMap<>();
+ }
+ };
+ private final ThreadLocal<WeakHashMap<IType, String>> fNormalizedTypeStringCache = new ThreadLocal<WeakHashMap<IType, String>>() {
+ @Override
+ protected WeakHashMap<IType, String> initialValue() {
+ return new WeakHashMap<>();
+ }
+ };
@Override
public final IASTTranslationUnit getTranslationUnit() {
@@ -585,6 +595,6 @@ public abstract class ASTTranslationUnit extends ASTNode implements IASTTranslat
}
public Map<IType, String> getTypeStringCache(boolean normalized) {
- return normalized ? fNormalizedTypeStringCache : fUnnormalizedTypeStringCache;
+ return normalized ? fNormalizedTypeStringCache.get() : fUnnormalizedTypeStringCache.get();
}
}

Back to the top