Skip to content

Commit

Permalink
Add warning to "enclosing classes" search strategy for MergedAnnotations
Browse files Browse the repository at this point in the history
This commit adds a warning to the Javadoc for the
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES search strategy in
MergedAnnotations with regard to the scope of the search
algorithm.

See gh-28079
  • Loading branch information
sbrannen committed Mar 16, 2022
1 parent ad70878 commit 29d9828
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,18 @@ enum SearchStrategy {
* <p>This strategy is similar to {@link #TYPE_HIERARCHY} except that
* {@linkplain Class#getEnclosingClass() enclosing classes} are also
* searched.
* <p>Superclass annotations do not need to be meta-annotated with
* {@link Inherited @Inherited}.
* <p>Superclass and enclosing class annotations do not need to be
* meta-annotated with {@link Inherited @Inherited}.
* <p>When searching a {@link Method} source, this strategy is identical
* to {@link #TYPE_HIERARCHY}.
* <p><strong>WARNING:</strong> This strategy searches recursively for
* annotations on the enclosing class for any source type, regardless
* whether the source type is an <em>inner class</em>, a {@code static}
* nested class, or a nested interface. Thus, it may find more annotations
* than you would expect.
*/
TYPE_HIERARCHY_AND_ENCLOSING_CLASSES

}

}

0 comments on commit 29d9828

Please sign in to comment.