java - Resolve method call in annotation processor -
i want write annotation processor check method called in specific places. example:
interface command { @mustonlybecalledbyworker void execute(); } class worker { void work(command cmd) { cmd.execute(); // ok annotation processor } } class hacker { void work(command cmd) { cmd.execute(); // annotation processor gives error } }
i have annotation processor @supportedannotationtypes("*")
uses compiler tree api methodinvocationtree
s.
i thought there, declaration of called method.
now can method name , argument expressions.
but want distinguish between overloaded execute()
methods same number of arguments. need handle whole overload resolution myself? think mean manually resolve static types of arguments, , in cases type arguments of other methods.
so here question: how can correct declaration of potentially overloaded method? maybe can somehow out of javactask
?
i using intellij idea 14 , oracle's java 8 compiler. support language level 7 sufficient, solution java 8 support preferred.
Comments
Post a Comment