Revise type-level nullability in ConvertingComparator

This commit revises the type-level nullability declaration in
ConvertingComparator in order to adapt to recent nullability changes in
Converter.

This commit also revises the workaround in commit 53d9ba879d.

See gh-35947
This commit is contained in:
Sam Brannen
2025-12-08 11:22:14 +01:00
parent 9f77f401ad
commit 939aa84214
2 changed files with 3 additions and 3 deletions
@@ -17,6 +17,7 @@
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;
@@ -82,8 +83,7 @@ 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<Method> adviceKindComparator = new ConvertingComparator<>(
Comparator<Method> adviceKindComparator = new ConvertingComparator<Method, @Nullable Annotation>(
new InstanceComparator<>(
Around.class, Before.class, After.class, AfterReturning.class, AfterThrowing.class),
method -> {
@@ -36,7 +36,7 @@ import org.springframework.util.comparator.Comparators;
* @param <S> the source type
* @param <T> the target type
*/
public class ConvertingComparator<S, T> implements Comparator<S> {
public class ConvertingComparator<S, T extends @Nullable Object> implements Comparator<S> {
private final Comparator<T> comparator;