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

TTY: jdb's expression evaluation doesn't perform string conversion properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.2
    • 1.4.0
    • core-svc
    • None
    • mantis
    • generic
    • solaris_7

      When concatentation strings, jdb doesn't perform string conversion as
      required by the Java rules for evaluating expressions.

      frog:~/workspaces/test/jdbnontop $ ls -la
      total 4
      drwxr-xr-x 2 gafter 512 Oct 8 09:25 .
      drwxr-xr-x 63 gafter 1536 Oct 8 09:16 ..
      -rw-r--r-- 1 gafter 0 Oct 8 09:21 .jdbrc
      -rw-r--r-- 1 gafter 303 Oct 8 09:19 T.java
      frog:~/workspaces/test/jdbnontop $ cat -n T.java
           1 class T {
           2 String s;
           3 void f() {
           4 new T("f").g();
           5 }
           6 void g() {
           7 new T("g").h();
           8 }
           9 void h() {
          10 System.out.println(s);
          11 }
          12 public static void main(String[] args) {
          13 new T("main").f();
          14 }
          15 T(String s) {
          16 this.s = s;
          17 }
          18 public String toString() {
          19 return s;
          20 }
          21 }
      frog:~/workspaces/test/jdbnontop $ /java/re/j2se/1.4.0/nightly/binaries/solsparc/latest/bin/javac -g T.java
      frog:~/workspaces/test/jdbnontop $ /java/re/j2se/1.4.0/nightly/binaries/solsparc/latest/bin/jdb T
      Initializing jdb ...
      *** Reading commands from /home/gafter/workspaces/test/jdbnontop/.jdbrc
      > stop at T;10
      Usage: stop at <class>:<line_number> or
             stop in <class>.<method_name>[(argument_type,...)]
      > stop at T:10
      Deferring breakpoint T:10.
      It will be set after the class is loaded.
      > run
      run T
      >
      VM Started: Set deferred breakpoint T:10
       
      Breakpoint hit: "thread=main", T.h(), line=10 bci=0
      10 System.out.println(s);
       
      main[1] print this
       this = instance of T(id=281)
      main[1] print (" " + this)
       (" " + this) = " instance of T(id=281)"
      main[1]

      ###@###.### 2001-10-08

            duke J. Duke
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: