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

Type annotations on non-canonical types result in incorrect type_paths

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd_minor
    • Component/s: tools

      Description

      Consider:

      ```
      import java.lang.annotation.*;

      @Target(ElementType.TYPE_USE)
      @interface Foo{}

      class One {
        class I {}
      }

      class Two<T> extends One {
        Two<@Foo Object>.I f;
      }
      ```

      The canonical type of `Two<@Foo Object>.I` is `One.I`. When javac compiles this input it produces the following for the field 'f':

        One$I f;
          descriptor: LOne$I;
          flags: (0x0000)
          RuntimeInvisibleTypeAnnotations:
            0: #12(): FIELD, location=[TYPE_ARGUMENT(0)]
              Foo

      Note that the type_path for the type annotation in `Two<@Foo Object>.I` refers to a type argument that does not exist in the canonical type `One.I`.

        Attachments

          Activity

            People

            • Assignee:
              sadayapalam Srikanth Adayapalam
              Reporter:
              cushon Liam Miller-Cushon
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: