Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4434232

JDI: ThreadReference.frames(int,int) takes bad args, has bed spec

XMLWordPrintable

    • beta2
    • generic
    • generic
    • Verified



      Name: elR10090 Date: 04/05/2001




      Direct reading the following specification for the method
      com.sun.jdi.ThreadReference.frames(int, int) :
       
          public List frames(int start, int length)
                  throws IncompatibleThreadStateException

          Returns a List containing a range of StackFrame mirrors from
          the thread's current call stack.
          The thread must be suspended (normally through an interruption to the VM)
          to get this information, and
          it is only valid until the thread is resumed again.

           Parameters:
               start - the index of the first frame
               length - the number of frames to retrieve
           Returns:
               a List of StackFrame with the current frame first followed by each
      caller's frame.
           Throws:
               IncompatibleThreadStateException -
                   if the thread is not suspended in the target VM
               IndexOutOfBoundsException -
                   if the specified range is not within the range from 0 to
      frameCount() - 1.
               ObjectCollectedException -
                   if this object has been garbage collected.


      requires to consider the call ThreadReference.frames(int, -1)
      as an error regardless a value passed to first argument.

      However, the implementation of the method takes -1 as the valid parameter,
      and, provided first parameter is also valid,
      the returned value is the List of all StackFrame objects in the range.
      Thus, this case is like another one, specified for the method

          List jdi.ArrayReference.getValues(int index, int length)

      for which the correct call arrayreferenceObject.getValues(int, -1);
      returns List containing "all components to the end of this array" (see the
      spec).


      Hence, the specification for the method ThreadReference.frames(int, int)
      should be corrected in order to match its implementation.
      It is also highly desirable to make it directly specifying all possible cases,
      for instance, when 'length == 0'.



      ======================================================================

            rfield Robert Field (Inactive)
            latkinsunw Latkin Latkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: