How can I create an annotation processor that processes a Local Variable?

前端 未结 3 558
故里飘歌
故里飘歌 2020-12-10 15:28

I\'m trying to create an annotation for a local variable. I know that I can\'t retain the annotation in the generated bytecode, but I should be able to have access to the in

3条回答
  •  忘掉有多难
    2020-12-10 15:56

    As of Java 8, local variable annotations are stored in the classfile.

    A standard Java annotation processor does not process the bodies of methods. However, the Checker Framework enables you to write an annotation processor that processes every annotation including on local variables. Its annotation processors can even examine every statement of the program, whether annotated or not.

提交回复
热议问题