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

TYPE_USE annotations not allowed on type parameter

XMLWordPrintable

    • b67
    • 8

      Spec says this is okay, but currently the type-annotations compiler does not accept it.
      "A type annotation (one meta-annotated with @Target(ElementType.TYPE_USE)) is permitted to be written anywhere...@Target(ElementType.TYPE_PARAMETER) would permit — that is...on a type parameter declaration."

      @Retention(RUNTIME)
      @Target(ElementType.TYPE_USE)
      @interface Uv {}

      should be able to be used as

      @Uv public class Test1 {
      <@Uv T> String g(T t) { return null; } //gets error
      }

            ssides Steve Sides
            ssides Steve Sides
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: