@@ -38,17 +38,23 @@ public interface Annotated {
3838 * parser function to it and returns the result.
3939 * <p>
4040 * The result of the last call to this method is cached if {@code parser != null}.
41- * That is, if the same parser object is used again without any intervening calls with a different
42- * parser, the same result object will be returned.
41+ * That is, if an {@linkplain Object#equals(Object) equivalent} parser object is
42+ * used again without any intervening calls with a different parser, the same
43+ * result object will be returned.
44+ * <p>
45+ * Note: Since lambda objects implement {@link Object#equals(Object)} with identity,
46+ * if {@code parser} is a lambda object, it should be a singleton in a final
47+ * static field. There is no guarantee about the identity of the result of a
48+ * lambda expression (JLS {@jls 15.27.4}).
4349 *
4450 * @param <T> the type of the result produced by the parser function
4551 * @param parser a function that takes the declared annotation information and
4652 * produces a result of type T. If {@code null}, then the
4753 * AnnotationsInfo value that would have been parsed is returned and
4854 * the cache is not updated.
4955 * @return the result of applying the parser function to the declared annotation
50- * information, potentially retrieved from cache if the same parser
51- * object was previously used
56+ * information, potentially retrieved from cache if the identical parser object
57+ * was previously used
5258 */
5359 <T > T getDeclaredAnnotationInfo (Function <AnnotationsInfo , T > parser );
5460
0 commit comments