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

[lworld] C1 getstatic of a value box type is incorrect

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-valhalla
    • Fix Version/s: repo-valhalla
    • Component/s: hotspot
    • Labels:

      Description

      When running with C1, this program does not throw NPE as expected.

      public class StaticBox {
          static final value class V {
              final int v0 = 0, v1 = 0;
              static V make(int n) {
                  V v = V.default;
                  v = __WithField(v.v0, 1234 + n);
                  v = __WithField(v.v1, 5678 + n);
                  return v;
              }
          }

          static V.box nullBox = null;

          static V test() {
              return nullBox; // should throw NPE
          }

          public static void main(String args[]) {
              test();
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              iklam Ioi Lam
              Reporter:
              iklam Ioi Lam
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: