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

Need test for 8006825,classfile attribution in inner class of lambda expression.

XMLWordPrintable

      This is in type-annotations repository.
      Classfile Attribution is different in inner class of lambda expression.
      A type-annotations(as defined in below sample) on a field in an inner class not in a lambda expression results in RuntimeTypeAnnotations_attibute and RuntimeAnnotations_attribute. On a field in an innner class in a lambda expression, it leaves off the RuntimeAnnotations_attribute.

      @Retention(RUNTIME) @Target({TYPE_USE,FIELD}) @interface A { }

      class Test7{
          interface MapFun<T, R> { R m( T n); }
          MapFun<Class<?>,String> cs;
          void test() {
              cs = c -> {
                       class innerClass {
                           @A Class<?> icc = null;
                           innerClass(Class<?> _c) { icc = _c; }
                           String getString() { return icc.toString(); }
                       }
                       return new innerClass(c).getString();
              };
              System.out.println("cs.m : " + cs.m(Integer.class));
          }

          public static void main(String... args) {new Test7().test(); }
      }

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

              Created:
              Updated:
              Resolved: