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

Use of simple names in AnnotationValue#toString after JDK-8164819 breaks some annotation processors

    XMLWordPrintable

    Details

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

      Description

      AnnotationValue#toString returns "a string representation of this value ... in a form suitable for representing this value in the source code of an annotation."

      JDK-8164819 changed the implementation to be consistent with core reflection, and replaced the use of qualified names for types (in annotations and class literals) with simple names: http://hg.openjdk.java.net/jdk/jdk/rev/761b86d5563d#l2.24

      That change made it harder to use the toString() representation in annotation-processor generated code, because the referenced types may require imports. I've encountered a number of annotation processors that assumed AnnotationValue.toString() would return a 'self-contained' representation of the annotation value that didn't require any additional imports.

      Is it worth considering leaving the use of qualified names in AnnotationValue#toString, to make it easier to use the provided string representation in generated code?

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              cushon Liam Miller-Cushon
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated: