Question Details

No question body available.

Tags

java annotation-processing

Answers (1)

June 10, 2026 Score: 0 Rep: 108,483 Quality: Medium Completeness: 80%

Whenever you aren't done yet, in essence.

Commonish case 1: Defer to the next round

returning false means your AP will be called again in the next round. If there is a next round.

It is possible you want to:

  • Generate some additional source files.
  • You want to defer any further operations for the next round because you want the newly created source files to be 'involved'. For example, when you are browsing the type hierarchy, you want the types defined in the source files you just made to be included.
  • The generated source files do not have any annotation in them that you claim (that you return in getSupportedAnnotations), or it's just more convenient for you to also get handed to you in the next round the annotations in the triggering source file.

If you return true; then there will be a next non-final round (because you generated new source files), and you will be called (because once an AP is called it will be called in all subsequent rounds), but the list of source elements handed to you in future rounds will no longer include anything you got before that you return true; on. If you want invocations of your processor in future rounds to continue to receive the elements annotated with your annotation, you have to return false; (and presumably you will return true; in a later round).

Commonish case 2: Multiple APs / support APs

It is possible you want to know about some annotation's existence but you don't claim to be the thing that 'handles' them. You are merely interested in their existence.

This doesn't come up a lot - generally, it is a strange idea to 'mess' with annotations that you do not 'own' (their package name does not start your entity/organisation), but any processor that itself has public API with guarantees means you can choose to write a 'helper AP' that wants to know without claiming. This implies that there are multiple annotation processors that have overlapping annotations in their getSupportedAnnotations lists.

Both cases are fairly rare, and as a consequence, proper use of return false; is itself quite rare.