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

[REDO BACKPORT] type annotations are not visible to javac plugins across compilation boundaries

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P3 P3
    • 17-pool, 21-pool
    • tools
    • None
    • behavioral
    • low
    • Hide
      There are two known sources of compatibility impact from this change:

      (1) Annotation processors will be able to access new type annotations for elements loaded from the classpath. This can have observable side effects, for example if an annotation processor includes `TypeMirror#toString` output in diagnostics or generated code, that output may now include additional annotations.

      (2) Annotation processors may load additional class files from the classpath referenced by type annotations. This can cause compilation errors for compilations with incomplete classpaths, but which previously compiled because the missing classes were never loaded.
      Show
      There are two known sources of compatibility impact from this change: (1) Annotation processors will be able to access new type annotations for elements loaded from the classpath. This can have observable side effects, for example if an annotation processor includes `TypeMirror#toString` output in diagnostics or generated code, that output may now include additional annotations. (2) Annotation processors may load additional class files from the classpath referenced by type annotations. This can cause compilation errors for compilations with incomplete classpaths, but which previously compiled because the missing classes were never loaded.
    • Java API
    • Implementation

      Summary

      Update javac's implementation of TypeMirror to allow accessing type use annotations on types loaded from class files.

      Problem

      The implementation currently does not associate type use annotations loaded from class files with the corresponding types. This means that TypeMirror APIs including getAnnotationMirrors and toString do not accurately report type use annotations for types loaded from class files.

      Solution

      If a type annotation is present on a type read from a class file, the implementation should associate the annotation with its type.

      Specification

      No specification change; behavioral change only.

            cushon Liam Miller-Cushon
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: