public ObjectReference thisObject()

in src/main/java/com/jetbrains/jdi/StackFrameImpl.java [131:164]


    public ObjectReference thisObject() {
        validateStackFrame();
        MethodImpl currentMethod = (MethodImpl)location.method();
        if (currentMethod.isStatic() || currentMethod.isNative()) {
            return null;
        } else {
            if (thisObject == null) {
                PacketStream ps;

                /* protect against defunct frame id */
                synchronized (vm.state()) {
                    validateStackFrame();
                    ps = JDWP.StackFrame.ThisObject.
                                      enqueueCommand(vm, thread, id);
                }

                /* actually get it, now that order is guaranteed */
                try {
                    thisObject = JDWP.StackFrame.ThisObject.
                                      waitForReply(vm, ps).objectThis;
                } catch (JDWPException exc) {
                    switch (exc.errorCode()) {
                    case JDWP.Error.INVALID_FRAMEID:
                    case JDWP.Error.THREAD_NOT_SUSPENDED:
                    case JDWP.Error.INVALID_THREAD:
                        throw new InvalidStackFrameException();
                    default:
                        throw exc.toJDIException();
                    }
                }
            }
        }
        return thisObject;
    }