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

jdb does not recognize length field of arrays

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.2.0
    • 1.2.0
    • core-svc
    • 1.2beta4
    • x86
    • windows_nt
    • Verified



      Name: ccC48265 Date: 12/12/97


      Breakpoint hit: foo.main (foo:3)
      main[1] list
      1 public class Foo {
      2 static public void main(String argv[]) {
      3 => Foo[] f = new Foo[3];
      4 }
      5 }
      main[1] next
      main[1]
      Breakpoint hit: foo.main (foo:2)
      main[1] print f
      f = { null, null, null }
      main[1] print f.length
      "length" is not a valid field of { null, null, null }
      main[1]

      ----- TEST CASE ----->

      Put this code (minus the line numbers, of course) into a file called
      Foo.java.

          1 public class Foo {
          2 static public void main(String argv[]) {
          3 => Foo[] f = new Foo[3];
          4 }
          5 }

      Compile it using "javac -g Foo.java".

      Run it using "jdb Foo"

      Say "stop in foo.main". Type "run". Type "next". Type "print f".
      Type "print f.length".
      (Review ID: 21817)
      =======================================================================
      ###@###.### (Dec 12, 1997):

      Using JDK1.2beta2(Y), I was able to reproduce this bug. I also tried
      replacing the line `Foo[] f = new Foo[3];' with `int[] i = {1,2,3};' and
      (as expected) I got a similar error message:

      main[1] print i.length
      "length" is not a valid field of { 1, 2, 3 }

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

            ghirschsunw Gordon Hirsch (Inactive)
            ccresswesunw Claudette Cresswell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: