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

no-@Target annotations should be applicable to type parameter declarations

    XMLWordPrintable

Details

    • CSR
    • Resolution: Approved
    • P4
    • 21
    • tools
    • None
    • source
    • minimal
    • The change does not alter the behaviour of any existing programs. It expands the space of compilable programs.
    • Language construct
    • Implementation

    Description

      Summary

      Annotations with no @Target annotation should be applicable to type parameter declarations.

      Problem

      JLS 9.6.4.1 specifies that annotations without an @Target annotation are applicable in 'all declaration contexts', which includes type parameter declarations. The implementation does not permit annotations without an @Target annotation to be applied to type parameter declarations.

      Solution

      The proposed solution updates the implementation to permit annotations without an @Target annotation to be applied to type parameter declarations. This change affects -source/--release 14 and higher.

      Specification

      No specification changes are required.

      The change applies to JLS 14 and newer, which was the first version to update JLS 9.6.4.1 to allow annotations without an @Target annotation on type parameter declarations.

      The proposed change to update the implementation to match the specification can be found in https://git.openjdk.java.net/jdk/pull/12914.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: