package org.jetbrains.debugger;

import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;

public abstract class ContextDependentAsyncResultConsumer<T> implements Consumer<T> {
  private final Vm vm;
  protected final SuspendContext context;

  public ContextDependentAsyncResultConsumer(@NotNull Vm vm, @NotNull SuspendContext context) {
    this.vm = vm;
    this.context = context;
  }

  @Override
  public final void consume(T result) {
    if (vm.isAttached() && !vm.getSuspendContextManager().isContextObsolete(context)) {
      consume(result, vm);
    }
  }

  protected abstract void consume(T result, @NotNull Vm vm);
}
@@ -194,31 +194,8 @@
 %3E %7B%0A
-  private final Vm vm;%0A
   pr
@@ -291,24 +291,8 @@
 ull 
-Vm vm, @NotNull 
 Susp
@@ -317,26 +317,8 @@
 ) %7B%0A
-    this.vm = vm;%0A
     
@@ -394,24 +394,53 @@
 T result) %7B%0A
+    Vm vm = context.getVm();%0A
     if (vm.i

simplify – suspend context has reference to vm