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

It is impossible to query type annotations of a receiver type's parameters

XMLWordPrintable

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      As shown in the code sample, a receiver type is always resolved as a raw annotated type what makes it impossible to query for parameter type annotations.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      A receiver type is parameterized.
      ACTUAL -
      A receiver type is not parameterized.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      class Foo<T> {
        void foo(Foo<@Bar T> this) {}
      }

      assert Foo.class.getDeclaredMethod("foo")
                      .getAnnotatedReceiverType()
        instanceof AnnotatedParameterizedType;
      ---------- END SOURCE ----------

            darcy Joe Darcy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: