示例#1
0
  private void methodResult(ExecutionEvent event) {
    if (recordMethodCalls) {
      String result = null;
      String resultType = event.getResult();

      if (resultType == ExecutionEvent.NORMAL_EXIT) {
        DebuggerObject object = event.getResultObject();
        if (object != null) {
          if (event.getClassName() != null && event.getMethodName() == null) {
            // Constructor call - the result object is the created object.
            // Don't display the result separately:
            return;
          } else {
            // if the method returns a void, we must handle it differently
            if (object.isNullObject()) {
              return; // Don't show result of void calls
            } else {
              // other - the result object is a wrapper with a single result field
              DebuggerField resultField = object.getField(0);
              result = "    returned " + resultField.getType().toString(true) + " ";
              result += resultField.getValueString();
            }
          }
        }
      } else if (resultType == ExecutionEvent.EXCEPTION_EXIT) {
        result = "    Exception occurred.";
      } else if (resultType == ExecutionEvent.TERMINATED_EXIT) {
        result = "    VM terminated.";
      }

      if (result != null) {
        text.appendMethodCall(result + "\n");
      }
    }
  }
示例#2
0
  /**
   * Used by BField to get hold of the real Object
   *
   * @return The objectReference value
   */
  ObjectReference getObjectReference() {
    if (objectWrapper == null) {
      return null;
    }
    DebuggerObject obj = objectWrapper.getObject();

    if (obj == null) {
      return null;
    }
    return obj.getObjectReference();
  }