From 53d9ba879d09c0f6cd5f4b7d2aa6ec7b52ab70c1 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 5 Dec 2025 16:53:24 +0100 Subject: [PATCH] Suppress NullAway warning for nullable Annotation return value --- .../aspectj/annotation/ReflectiveAspectJAdvisorFactory.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java index 3ee5762adf0..79ed7ca75ee 100644 --- a/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java +++ b/spring-aop/src/main/java/org/springframework/aop/aspectj/annotation/ReflectiveAspectJAdvisorFactory.java @@ -17,7 +17,6 @@ package org.springframework.aop.aspectj.annotation; import java.io.Serializable; -import java.lang.annotation.Annotation; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.util.ArrayList; @@ -48,7 +47,6 @@ import org.springframework.aop.framework.AopConfigException; import org.springframework.aop.support.DefaultPointcutAdvisor; import org.springframework.beans.factory.BeanFactory; import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.ConvertingComparator; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; @@ -84,10 +82,11 @@ public class ReflectiveAspectJAdvisorFactory extends AbstractAspectJAdvisorFacto // @AfterThrowing methods due to the fact that AspectJAfterAdvice.invoke(MethodInvocation) // invokes proceed() in a `try` block and only invokes the @After advice method // in a corresponding `finally` block. + @SuppressWarnings("NullAway") Comparator adviceKindComparator = new ConvertingComparator<>( new InstanceComparator<>( Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class), - (Converter) method -> { + method -> { AspectJAnnotation ann = AbstractAspectJAdvisorFactory.findAspectJAnnotationOnMethod(method); return (ann != null ? ann.getAnnotation() : null); });