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

Confusing / incorrect error message regarding annotations on non-declarations

    Details

    • Subcomponent:
    • Resolved In Build:
      b61
    • Verification:
      Verified

      Backports

        Description

        In the program below, the annotation is attached to the use of a type. This is strictly speaking not a declaration.

            import java.lang.annotation.*;
            @Target(ElementType.METHOD)
            @interface A { }
            class NonDeclaration extends java.util.ArrayList<@A String> { }

        Currently java reports the following error:

            NonDeclaration.java:4: error: annotation type not applicable to this kind of declaration
            class NonDeclaration extends java.util.ArrayList<@A String> { }
                                                             ^
            1 error

        The error message should be reformulated.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  alundblad Andreas Lundblad (Inactive)
                  Reporter:
                  alundblad Andreas Lundblad (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: