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

[lworld] Wrong code generated for PrimitiveClass.ref.default

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      The following program should print null, but instead ends up with a primitive class instance due to incorrect code generation.

      public primitive class X {

          public static void main(String [] args) {
              Object o = X.ref.default;
              System.out.println(o);
          }
      }


      JEP401 states: "Every type has a default value, used to populate newly-allocated fields and array components of that type. " which affirms that

      X.ref.default should actually be null since that is the default value
      of primitive reference types.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sadayapalam Srikanth Adayapalam
              Reporter:
              sadayapalam Srikanth Adayapalam
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: