Skip to content

Commit 9d7abb0

Browse files
committed
GH-1342 - Avoid potential NullPointerException in annotation lookup for JavaPackage.
We now explicitly filter null values in the annotation lookup that could stem from the initial filtering based on the sole presence of the annotation and the subsequent step trying to load that annotation.
1 parent ec7022c commit 9d7abb0

File tree

1 file changed

+1
-0
lines changed
  • spring-modulith-core/src/main/java/org/springframework/modulith/core

1 file changed

+1
-0
lines changed

spring-modulith-core/src/main/java/org/springframework/modulith/core/JavaPackage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ public <A extends Annotation> Optional<A> findAnnotation(Class<A> annotationType
412412
.stream()
413413
.map(JavaClass::reflect)
414414
.map(it -> AnnotatedElementUtils.findMergedAnnotation(it, annotationType))
415+
.filter(it -> it != null)
415416
.toList();
416417

417418
if (annotatedTypes.size() > 1) {

0 commit comments

Comments
 (0)