[lworld] Treat @NullRestricted fields as ACC_STRICT_INIT on load

XMLWordPrintable

    • Type: Bug
    • Resolution: Unresolved
    • Priority: P4
    • None
    • Affects Version/s: repo-valhalla
    • Component/s: hotspot
    • None

      Tests to exercise non-null value class field layouts do so via the @jdk.internal.vm.annotation.NullRestricted annotation. Today, these fields must be marked with @Strict as well, and then javac gives them special treatment during compilation.

      Eventually, these tests will be written with !, and javac will compile the fields using strict initialization rules. In the mean time, javac's behavior is ad hoc and inappropriate for a standard JDK release.

      Until the language feature is ready, HotSpot should simply recognize that any field marked with @NullRestricted is implicitly ACC_STRICT_INIT, and validate the class accordingly. (HotSpot already recognizes @NullRestricted as a trigger for special behaviors, so this is just one more thing.)

      This will free javac from the obligation to do anything special with the annotation, and (with some other changes) allow us to remove the @Strict annotation entirely.

            Assignee:
            Chen Liang
            Reporter:
            Dan Smith
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: