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

jdb should not allow to assign null to value type

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P3
    • Resolution: Fixed
    • repo-valhalla
    • repo-valhalla
    • core-svc
    • None

    Description

      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:8
      4. Run to breakpoint
      > run
      5. Assign null to variable v
      > set v = null
      or
      > eval v = null
      6. Print value of v
      > print v

      Expected result:
      On step 5 the error "error: incompatible types: <null> cannot be converted to MyValue" should be reported
      Actual result:
      Step 5 succeeds. Step 6 outputs "v = null"

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

        public static void main(String[] args){

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

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

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

        }

      }


      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: