[debugger-dfa] Remove repeating values from jdiValueMap

GitOrigin-RevId: 10a0fcc7a289a994693ef77ef957008008a0eee8
This commit is contained in:
Tagir Valeev
2024-11-11 16:52:09 +00:00
committed by intellij-monorepo-bot
parent 40cc02ba8e
commit 55933d65d3
@@ -161,16 +161,15 @@ public class DebuggerDfaRunner {
Set<VariableDescriptor> descriptors = StreamEx.of(flow.getInstructions()).flatCollection(inst -> inst.getRequiredDescriptors(factory))
.toSet();
Map<Value, List<DfaVariableValue>> myMap = new HashMap<>();
for (DfaValue dfaValue : factory.getValues().toArray(DfaValue.EMPTY_ARRAY)) {
StreamEx<DfaVariableValue> stream = StreamEx.of(descriptors)
.map(desc -> desc.createValue(factory, dfaValue))
.append(dfaValue)
.select(DfaVariableValue.class);
for (DfaVariableValue dfaVar : stream) {
Value jdiValue = resolveJdiValue(provider, anchor, proxy, dfaVar);
if (jdiValue != null) {
myMap.computeIfAbsent(jdiValue, v -> new ArrayList<>()).add(dfaVar);
}
StreamEx<DfaVariableValue> stream =
StreamEx.of(factory.getValues().toArray(DfaValue.EMPTY_ARRAY))
.flatMap(dfaValue -> StreamEx.of(descriptors).map(desc -> desc.createValue(factory, dfaValue)).append(dfaValue))
.select(DfaVariableValue.class)
.distinct();
for (DfaVariableValue dfaVar : stream) {
Value jdiValue = resolveJdiValue(provider, anchor, proxy, dfaVar);
if (jdiValue != null) {
myMap.computeIfAbsent(jdiValue, v -> new ArrayList<>()).add(dfaVar);
}
}
return myMap;