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

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

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 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

      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.

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

              Created:
              Updated:
              Resolved: