Skip to content

Commit 582bafe

Browse files
committed
ClassUtils: be defensive about field annotations
We already do this when caching annotations for methods; see 52acc85. It is possible for the list of fields to be null if something goes sideways regarding class loading.
1 parent 986cf82 commit 582bafe

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,8 @@ public static <A extends Annotation> void getAnnotatedFields(
189189
cacheAnnotatedObjects(c, query);
190190
cachedFields = fieldCache.getList(c, annotationClass);
191191
}
192-
// CTR START HERE: cachedFields should never be null now.
193-
// But it is, with FilamentDetector 1.0.0. Figure out why and fix.
194-
// Then cut release of scijava-common, and FilamentDetector.
195192

196-
fields.addAll(cachedFields);
193+
if (cachedFields != null) fields.addAll(cachedFields);
197194
}
198195

199196
/**

0 commit comments

Comments
 (0)