Skip to content

Commit 3c582e3

Browse files
committed
ClassUtils: fix javadoc for annotated list results
What was written in the javadoc used to be true, but for performance reasons, we added a cache for situations where the same request is made multiple times. This commit updates the javadoc to reflect the new reality. Closes #252.
1 parent 70c50f4 commit 3c582e3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/org/scijava/util/ClassUtils.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,9 @@ public static URL getLocation(final Class<?> c) {
364364
*
365365
* @param c The class to scan for annotated methods.
366366
* @param annotationClass The type of annotation for which to scan.
367-
* @return A new list containing all methods with the requested annotation.
367+
* @return A list containing all methods with the requested annotation. Note
368+
* that for performance reasons, lists may be cached and reused, so it
369+
* is best to make a copy of the result if you need to modify it.
368370
*/
369371
public static <A extends Annotation> List<Method> getAnnotatedMethods(
370372
final Class<?> c, final Class<A> annotationClass)
@@ -417,7 +419,9 @@ public static <A extends Annotation> List<Method> getAnnotatedMethods(
417419
*
418420
* @param c The class to scan for annotated fields.
419421
* @param annotationClass The type of annotation for which to scan.
420-
* @return A new list containing all fields with the requested annotation.
422+
* @return A list containing all fields with the requested annotation. Note
423+
* that for performance reasons, lists may be cached and reused, so it
424+
* is best to make a copy of the result if you need to modify it.
421425
*/
422426
public static <A extends Annotation> List<Field> getAnnotatedFields(
423427
final Class<?> c, final Class<A> annotationClass)

0 commit comments

Comments
 (0)