Skip to content

Commit b5795d7

Browse files
committed
ClassUtils: explain why we skip Object.class
1 parent 230bc8f commit b5795d7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ public static <A extends Annotation> List<Method> getAnnotatedMethods(
307307
getAnnotatedMethods(final Class<?> c, final Class<A> annotationClass,
308308
final List<Method> methods)
309309
{
310+
// NB: The java.lang.Object class does not have any annotated methods.
311+
// And even if it did, it definitely does not have any methods annotated
312+
// with SciJava annotations such as org.scijava.event.EventHandler, which
313+
// are the main sorts of methods we are interested in.
310314
if (c == null || c == Object.class) return;
311315

312316
// check supertypes for annotated methods first
@@ -363,6 +367,10 @@ public static <A extends Annotation> List<Field> getAnnotatedFields(
363367
public static <A extends Annotation> void getAnnotatedFields(
364368
final Class<?> c, final Class<A> annotationClass, final List<Field> fields)
365369
{
370+
// NB: The java.lang.Object class does not have any annotated fields.
371+
// And even if it did, it definitely does not have any fields annotated
372+
// with SciJava annotations such as org.scijava.plugin.Parameter, which
373+
// are the main sorts of fields we are interested in.
366374
if (c == null || c == Object.class) return;
367375

368376
// check supertypes for annotated fields first

0 commit comments

Comments
 (0)