From 17c778e3a00f7ad2fa836db8bdb51d1c6728cb0b Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 5 May 2022 17:26:17 +0200 Subject: [PATCH] Preserve javax nullability annotations for AOP Alliance fork See gh-28410 --- .../intercept/ConstructorInterceptor.java | 6 +- .../intercept/ConstructorInvocation.java | 6 +- .../org/aopalliance/intercept/Invocation.java | 6 +- .../org/aopalliance/intercept/Joinpoint.java | 8 +- .../intercept/MethodInterceptor.java | 8 +- .../intercept/MethodInvocation.java | 6 +- src/checkstyle/checkstyle-suppressions.xml | 145 +++++++------- src/checkstyle/checkstyle.xml | 180 +++++++++--------- 8 files changed, 184 insertions(+), 181 deletions(-) diff --git a/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInterceptor.java b/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInterceptor.java index 3a074fd76e..8ac8f65ca3 100644 --- a/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInterceptor.java +++ b/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.aopalliance.intercept; -import org.springframework.lang.NonNull; +import javax.annotation.Nonnull; /** * Intercepts the construction of a new object. @@ -56,7 +56,7 @@ public interface ConstructorInterceptor extends Interceptor { * @throws Throwable if the interceptors or the target object * throws an exception */ - @NonNull + @Nonnull Object construct(ConstructorInvocation invocation) throws Throwable; } diff --git a/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInvocation.java b/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInvocation.java index c63caef3c4..72951383e9 100644 --- a/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInvocation.java +++ b/spring-aop/src/main/java/org/aopalliance/intercept/ConstructorInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.aopalliance.intercept; import java.lang.reflect.Constructor; -import org.springframework.lang.NonNull; +import javax.annotation.Nonnull; /** * Description of an invocation to a constructor, given to an @@ -38,7 +38,7 @@ public interface ConstructorInvocation extends Invocation { * {@link Joinpoint#getStaticPart()} method (same result). * @return the constructor being called */ - @NonNull + @Nonnull Constructor getConstructor(); } diff --git a/spring-aop/src/main/java/org/aopalliance/intercept/Invocation.java b/spring-aop/src/main/java/org/aopalliance/intercept/Invocation.java index bd316a9dd7..96caaefefe 100644 --- a/spring-aop/src/main/java/org/aopalliance/intercept/Invocation.java +++ b/spring-aop/src/main/java/org/aopalliance/intercept/Invocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ package org.aopalliance.intercept; -import org.springframework.lang.NonNull; +import javax.annotation.Nonnull; /** * This interface represents an invocation in the program. @@ -34,7 +34,7 @@ public interface Invocation extends Joinpoint { * array to change the arguments. * @return the argument of the invocation */ - @NonNull + @Nonnull Object[] getArguments(); } diff --git a/spring-aop/src/main/java/org/aopalliance/intercept/Joinpoint.java b/spring-aop/src/main/java/org/aopalliance/intercept/Joinpoint.java index 56a2b77118..480d9f087c 100644 --- a/spring-aop/src/main/java/org/aopalliance/intercept/Joinpoint.java +++ b/spring-aop/src/main/java/org/aopalliance/intercept/Joinpoint.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package org.aopalliance.intercept; import java.lang.reflect.AccessibleObject; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * This interface represents a generic runtime joinpoint (in the AOP @@ -65,7 +65,7 @@ public interface Joinpoint { *

The static part is an accessible object on which a chain of * interceptors are installed. */ - @NonNull + @Nonnull AccessibleObject getStaticPart(); } diff --git a/spring-aop/src/main/java/org/aopalliance/intercept/MethodInterceptor.java b/spring-aop/src/main/java/org/aopalliance/intercept/MethodInterceptor.java index 8b327568b6..9188e25e1d 100644 --- a/spring-aop/src/main/java/org/aopalliance/intercept/MethodInterceptor.java +++ b/spring-aop/src/main/java/org/aopalliance/intercept/MethodInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,8 @@ package org.aopalliance.intercept; -import org.springframework.lang.NonNull; -import org.springframework.lang.Nullable; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; /** * Intercepts calls on an interface on its way to the target. These @@ -56,6 +56,6 @@ public interface MethodInterceptor extends Interceptor { * throws an exception */ @Nullable - Object invoke(@NonNull MethodInvocation invocation) throws Throwable; + Object invoke(@Nonnull MethodInvocation invocation) throws Throwable; } diff --git a/spring-aop/src/main/java/org/aopalliance/intercept/MethodInvocation.java b/spring-aop/src/main/java/org/aopalliance/intercept/MethodInvocation.java index 78a2d44cbc..f1f511bea4 100644 --- a/spring-aop/src/main/java/org/aopalliance/intercept/MethodInvocation.java +++ b/spring-aop/src/main/java/org/aopalliance/intercept/MethodInvocation.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.aopalliance.intercept; import java.lang.reflect.Method; -import org.springframework.lang.NonNull; +import javax.annotation.Nonnull; /** * Description of an invocation to a method, given to an interceptor @@ -38,7 +38,7 @@ public interface MethodInvocation extends Invocation { * {@link Joinpoint#getStaticPart()} method (same result). * @return the method being called */ - @NonNull + @Nonnull Method getMethod(); } diff --git a/src/checkstyle/checkstyle-suppressions.xml b/src/checkstyle/checkstyle-suppressions.xml index b0a4d98374..b24ed59d9c 100644 --- a/src/checkstyle/checkstyle-suppressions.xml +++ b/src/checkstyle/checkstyle-suppressions.xml @@ -3,117 +3,120 @@ - - - + + + - + - + + + + - - - - - + + + + + - + - - + + - - - - + + + + - - - + + + - + - + - - - - - + + + + + - - - - - - - + + + + + + + - - + + - - - + + + - - - - + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - + - - - - - - + + + + + + - - - - - + + + + + diff --git a/src/checkstyle/checkstyle.xml b/src/checkstyle/checkstyle.xml index d588b78584..a8764a5474 100644 --- a/src/checkstyle/checkstyle.xml +++ b/src/checkstyle/checkstyle.xml @@ -8,7 +8,7 @@ - + @@ -19,125 +19,125 @@ - + - - + + + value="false"/> - + - + - + - - + + - - - + + + - + - - + + - - + + + value="Class name ''{0}'' must not end with ''Test'' (checked pattern ''{1}'')."/> - - - - - - + + + + + + - + - + - + - + - + - + - - + + - + - + - - + + - + - - - - - + + + + + - + + value="^reactor\.core\.support\.Assert,^org\.slf4j\.LoggerFactory,^(?!org\.springframework).*(NonNull|Nonnull|NonNullApi|NonNullFields|Nullable)$"/> - - + + - + + value="^org\.junit\.(Test|BeforeClass|AfterClass|Before|After|Ignore|FixMethodOrder|Rule|ClassRule|Assert|Assume)$,^org\.junit\.(Assert|Assume)\..+,^org\.junit\.(experimental|internal|matchers|rules|runner|runners|validator)\..+"/> - - + + - - + + - - + + - - + + @@ -155,7 +155,7 @@ - + @@ -172,74 +172,74 @@ - - - + + + - + - + value="Line has leading space characters; indentation should be performed with tabs only."/> + - - - + + + - + + value="assertThatExceptionOfType\((NullPointerException|IllegalArgumentException|IOException|IllegalStateException)\.class\)"/> - + value="Please use specialized AssertJ assertThat*Exception method."/> + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - - - + + +