public static StackTraceElement[] approxSourceStackTraceElement(BytecodePosition bytecodePosition){
  ArrayList<StackTraceElement> elements=new ArrayList<>();
  BytecodePosition position=bytecodePosition;
  while (position != null) {
    ResolvedJavaMethod method=position.getMethod();
    if (method != null) {
      elements.add(method.asStackTraceElement(position.getBCI()));
    }
    position=position.getCaller();
  }
  return elements.toArray(new StackTraceElement[0]);
}

public static StackTraceElement [ ] approxSourceStackTraceElement ( BytecodePosition bytecodePosition ) { ArrayList < StackTraceElement > elements = new ArrayList < > ( ) ; BytecodePosition position = bytecodePosition ; while ( position != null ) { ResolvedJavaMethod method = position . getMethod ( ) ; if ( method != null ) { elements . add ( method . asStackTraceElement ( position . getBCI ( ) ) ) ; } position = position . getCaller ( ) ; } return elements . toArray ( new StackTraceElement [ 0 ] ) ; }
gets approximate stack trace elements for a bytecode position .
