-
Bug
-
Resolution: Fixed
-
P4
-
None
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(); }
}
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(); }
}