How to implement something similar to the @Override java annotation?

前端 未结 2 1736
眼角桃花
眼角桃花 2021-02-04 19:36

With this jdk code in ../java/lang/Override.java,

package java.lang;
import java.lang.annotation.*;
@Target(ElementType.METHOD)
@Retention(Retentio         


        
2条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 20:00

    The implementation that triggers the compile error doesn't lie in the annotation, it lies in the Java compiler.

    If you want to write your own similar annotation processor, you would use the annotation processor API: http://docs.oracle.com/javase/7/docs/api/javax/annotation/processing/Processor.html

提交回复
热议问题