fetching annotations from lambda expressions

Steve Sides steve.sides at oracle.com
Mon Mar 11 11:22:43 PDT 2013


Hang on. I think I found them. :)  I wasn't feeding them through the 
loop search code attributes.
No need to reply to this just yet.

thanks,
steve

On 3/11/2013 10:16 AM, Steve Sides wrote:
> 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