process()方法的返回值表示什么?

来源:4-6 实战:采集注解【注解处理器实现】

逐梦稚者

2021-03-11

process()方法返回的boolean类型,表示什么意思?什么时候应该是true?

写回答

1回答

allenfeng

2021-03-12

可以查阅 官方文档

Processes a set of annotation types on type elements originating from the prior round and returns whether or not these annotation types are claimed by this processor. If true is returned, the annotation types are claimed and subsequent processors will not be asked to process them; if false is returned, the annotation types are unclaimed and subsequent processors may be asked to process them. A processor may always return the same boolean value or may vary the result based on chosen criteria.

如果当前注解处理器已经处理了传递进来的注解,你不希望它们被传递给剩余其他注解处理器的话,返回true。

0
0

Android 应用程序构建实战+原理精讲

深度掌握 Gradle 使用,系统性学习 Android 应用构建知识

450 学习 · 116 问题

查看课程