public static StackTraceElement[] approxSourceStackTraceElement(FrameState frameState){
  ArrayList<StackTraceElement> elements=new ArrayList<>();
  FrameState state=frameState;
  while (state != null) {
    Bytecode code=state.getCode();
    if (code != null) {
      elements.add(code.asStackTraceElement(state.bci - 1));
    }
    state=state.outerFrameState();
  }
  return elements.toArray(new StackTraceElement[0]);
}

public static StackTraceElement [ ] approxSourceStackTraceElement ( FrameState frameState ) { ArrayList < StackTraceElement > elements = new ArrayList < > ( ) ; FrameState state = frameState ; while ( state != null ) { Bytecode code = state . getCode ( ) ; if ( code != null ) { elements . add ( code . asStackTraceElement ( state . bci - 1 ) ) ; } state = state . outerFrameState ( ) ; } return elements . toArray ( new StackTraceElement [ 0 ] ) ; }
gets an approximate source code location for frame state .
