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

[type-restrictions] Assorted issues with generation of RestrictedField attributes from annotations

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Follow up to JDK-8255856

      (1) There is no need to persist the RestrictedType annotation in the class files or have them loaded at run time. Source file level retention is good enough.

      (2) @RestrictedType annotating a field which was declared to be a
      reference projection, results in a compilation error:

          @RestrictedType("QPoint;")
          public Point.ref p368;

      $ javac PointBox.java
      PointBox.java:12: error: scoping construct cannot be annotated with type-use annotation: @java.lang.invoke.RestrictedType("QPoint;")
          public Point.ref p368;

      (3) Frederic reports that independent compiles trigger an assertion error in:
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader$28.read(ClassReader.java:1273)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readAttrs(ClassReader.java:1408)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readMemberAttrs(ClassReader.java:1398)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readField(ClassReader.java:2242)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:2595)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassBuffer(ClassReader.java:2674)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFileInternal(ClassReader.java:2714)
      at jdk.compiler/com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:2678)
      at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:362)

      (4) The tests are better written avoiding javacp output since this makes them fragile to constant pool index changes.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: