为什么我们需要在某些时候丢弃注释?
Why do we need to discard annotations at some point?
我目前正在学习 Android 注释主题。我读过这个 "A retention policy determines at what point annotation should be discarded."
我的问题是为什么 Java 需要在某些时候丢弃注释?或者为了什么目的?
参考:https://www.java2novice.com/java-annotations/retention-policy
一些注解仅供编译时使用(因此编译器可以做很多事情,例如生成代码 (ButterKnife and Dagger) or showing warnings (like DrawableRes), helping auto complete for IDE like IntDef),不会在 运行 时间内使用。因此它们将被丢弃。
我目前正在学习 Android 注释主题。我读过这个 "A retention policy determines at what point annotation should be discarded." 我的问题是为什么 Java 需要在某些时候丢弃注释?或者为了什么目的?
参考:https://www.java2novice.com/java-annotations/retention-policy
一些注解仅供编译时使用(因此编译器可以做很多事情,例如生成代码 (ButterKnife and Dagger) or showing warnings (like DrawableRes), helping auto complete for IDE like IntDef),不会在 运行 时间内使用。因此它们将被丢弃。