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

(reflect) enclosing type parameter missing in anonymous and local classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 5.0
    • 5.0
    • core-libs

      The following reflection test case fails (t is assigned null):

      import java.lang.reflect.*;

      class A<T> {
          Object o = new Object() {
              public T t;
          };
          public static void main(String[] args) throws NoSuchFieldException {
              Type t = new A<Integer>().o.getClass().getField("t").getGenericType();
              if (!(t instanceof TypeVariable))
                  throw new Error("" + t);
          }
      }

            ahe Peter Ahe
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: