This is an automated email from the ASF dual-hosted git repository.

mattsicker pushed a commit to branch feature/3.x/name-alias-provider
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git

commit 2b7815c13c0bb518565b10a6e5ae9e41a2cbe014
Author: Matt Sicker <[email protected]>
AuthorDate: Thu Aug 7 14:52:48 2025 -0500

    Add nullability clarification
---
 .../apache/logging/log4j/plugins/internal/util/AnnotationUtil.java   | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/internal/util/AnnotationUtil.java
 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/internal/util/AnnotationUtil.java
index 5bd9cb13a5..0690d9fd98 100644
--- 
a/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/internal/util/AnnotationUtil.java
+++ 
b/log4j-plugins/src/main/java/org/apache/logging/log4j/plugins/internal/util/AnnotationUtil.java
@@ -30,6 +30,7 @@ import java.util.stream.Stream;
 import org.apache.logging.log4j.plugins.Ordered;
 import org.apache.logging.log4j.plugins.di.Key;
 import org.apache.logging.log4j.plugins.di.spi.InjectionPoint;
+import org.jspecify.annotations.Nullable;
 
 public final class AnnotationUtil {
 
@@ -53,7 +54,7 @@ public final class AnnotationUtil {
      * @param metaAnnotation expected annotation to find present on annotation
      * @return the annotation with meta-annotation if present or {@code null} 
if none match
      */
-    public static Annotation getElementAnnotationHavingMetaAnnotation(
+    public static @Nullable Annotation 
getElementAnnotationHavingMetaAnnotation(
             final AnnotatedElement element, final Class<? extends Annotation> 
metaAnnotation) {
         return findAnnotatedAnnotations(element, metaAnnotation)
                 .map(AnnotatedAnnotation::annotation)
@@ -101,7 +102,7 @@ public final class AnnotationUtil {
      * @param annotationType class of logical annotation
      * @return a logical annotation instance or {@code null} if none are found
      */
-    public static <A extends Annotation> A getLogicalAnnotation(
+    public static <A extends Annotation> @Nullable A getLogicalAnnotation(
             final AnnotatedElement element, final Class<A> annotationType) {
         return findLogicalAnnotations(element, 
annotationType).findFirst().orElse(null);
     }

Reply via email to