annotating local variables or method parameters

2019-09-08 05:18发布

问题:

According to the class ElementType in the API, you can annotate local variables and method parameters.

How is that done?

回答1:

Just the usual way:

void method(@SomeAttr int param){
    @SomeAttr 
    int local = param * 2;
}