TypeMirror is missing annotation

Alex Buckley alex.buckley at oracle.com
Thu Apr 6 17:45:19 UTC 2017


On 3/31/2017 11:22 PM, Marcel Kliemannel wrote:
> import java.util.function.Consumer;
> public class Test {
>      public void test() {
>          Consumer<@R String> consumer = input -> {};
>      }
> }
>
> -----------------------------------------
>
> I am expecting that the parameter ‘input’ of the lambda expression is of
> type ‘@R() java.lang.String’, but the TypeMirror of the Element ‘input’
> just gives me ‘java.lang.String’ without the annotation.

I don't recall anything in the JLS or API spec that mandates implicit 
transmission of type annotations in this manner.

Alex


More information about the compiler-dev mailing list