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

jdb "eval" should perform substitutability test when applying == to inline types

XMLWordPrintable

      1. Compile the sample test.
      2. Start jdb:
      $ jdb -classpath . -XX:+EnableValhalla Test
      3. Set breakpoint on the line with System.out.println()
      > stop at Test:10
      4. Run to breakpoint
      > run
      5. Invoke "eval" command
      > eval b == b
      6. Continue
      > cont
      7.Observe that the output printed by System.out.println("v == v " + (b == b)) is " v == v false"
       

      Expected result:
      The output on step 5 should be "b == b = false"
      Actual result:
      The output on step 5 should be "b == b = true"


      ====================================
      public class Test {

        public static void main(String[] args){

          MyValue v = new MyValue(12,'c');
          Object b = new Object();
          b = v;
          System.out.println("v == v " + (b == b));
        }

        public final __ByValue static class MyValue {
            int a;
            char b;

            public MyValue(int a, char b) {
              this.a = a;
              this.b = b;
            }
        }
      }

            fparain Frederic Parain
            dtitov Daniil Titov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: