they can be shared over multiply threads (by caches) so these can be altered by threads
diff --git a/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ElementValue.java b/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ElementValue.java index d0d6c3c..f2438ea 100644 --- a/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ElementValue.java +++ b/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ElementValue.java
@@ -18,6 +18,7 @@ import java.util.List; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.eclipse.dltk.annotations.Internal; import org.eclipse.dltk.compiler.problem.IProblemIdentifier; @@ -356,7 +357,7 @@ static class TypeValue extends ElementValue implements IValue { - private final Map<String, IValue> children = new HashMap<String, IValue>( + private final Map<String, IValue> children = new ConcurrentHashMap<String, IValue>( 4, 0.9f); private final JSTypeSet types;
diff --git a/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ImmutableValue.java b/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ImmutableValue.java index b62ef97..dce162e 100644 --- a/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ImmutableValue.java +++ b/plugins/org.eclipse.dltk.javascript.core/src/org/eclipse/dltk/internal/javascript/ti/ImmutableValue.java
@@ -6,6 +6,7 @@ import java.util.Iterator; import java.util.Map; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import org.eclipse.dltk.javascript.typeinference.ReferenceKind; import org.eclipse.dltk.javascript.typeinference.ReferenceLocation; @@ -290,16 +291,19 @@ value = ElementValue.findMemberA(declaredType, name, resolve); if (value != null) { if (elementValues == null) - elementValues = new HashMap<String, IValue>(4, 0.9f); + elementValues = new ConcurrentHashMap<String, IValue>( + 4, 0.9f); elementValues.put(name, value); return value; + } } for (IRType type : types) { value = ElementValue.findMemberA(type, name, resolve); if (value != null) { if (elementValues == null) - elementValues = new HashMap<String, IValue>(4, 0.9f); + elementValues = new ConcurrentHashMap<String, IValue>( + 4, 0.9f); if (resolve && value instanceof ElementValue) { value = ((ElementValue) value).resolveValue(); }