fetching annotations from lambda expressions

Steve Sides steve.sides at oracle.com
Mon Mar 11 10:16:53 PDT 2013


Hi,
I am having trouble finding the annotation attributes for type 
annotations on lambda expressions.

class Test2{
   interface MapFun<T, R> {  R m( T n); }
   MapFun<Integer, String> its;
   void test(Integer i) {
     its = a -> "~"+new @A @B Integer(a).toString()+"~";
     System.out.println("in: " + i + " out: " + its.m(i));
   }
}

The usual searching fields and methods of classfiles does not seem to do it.
For example, for something like the above, I see a lambda$0 method, but 
see no annotation attributes.

for some like this,
void test(Integer i) {
     // lambda expression as method arg
     meth( (@A @B String s) -> { @A @B Integer len = s.length(); return 
len; } );
}}

I get the two which are on the parameter ('s') but not the ones in the 
lambda expresson.
Any suggestions?

-steve


More information about the type-annotations-dev mailing list