List<TraceControllerImpl> (@NotNull ResolvedTracingResult resolvedResult) { List<TraceControllerImpl> controllers = new ArrayList<>(); final ResolvedStreamChain chain = resolvedResult.getResolvedChain(); final List<ResolvedStreamCall.Intermediate> intermediateCalls = chain.getIntermediateCalls(); final NextAwareState firstState = intermediateCalls.isEmpty() ? chain.getTerminator().getStateBefore() : intermediateCalls.get(0).getStateBefore(); final TraceControllerImpl firstController = new TraceControllerImpl(firstState); controllers.add(firstController); TraceControllerImpl prevController = firstController; for (final ResolvedStreamCall.Intermediate intermediate : intermediateCalls) { final PrevAwareState after = intermediate.getStateAfter(); final TraceControllerImpl controller = new TraceControllerImpl(after); prevController.setNextController(controller); controller.setPreviousController(prevController); prevController = controller; controllers.add(controller); } final ResolvedStreamCall.Terminator terminator = chain.getTerminator(); final IntermediateState afterTerminationState = terminator.getStateAfter(); if (afterTerminationState != null && !terminator.getCall().getResultType().equals(JavaTypes.INSTANCE.getVOID())) { final TraceControllerImpl terminationController = new TraceControllerImpl(afterTerminationState); terminationController.setPreviousController(prevController); prevController.setNextController(terminationController); controllers.add(terminationController); } controllers.forEach(x -> Disposer.register(myDisposable, x)); return controllers; }