Browse Source

Move RuntimeHints predicate support to a dedicated package

This commit moves `RuntimeHintsPredicate` and its support classes that
form a cohesive concept in a dedicated `.predicate` package.

Closes gh-28799
pull/28802/head
Stephane Nicoll 3 years ago
parent
commit
54a3f66d1d
  1. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanRegistrationAotContributionTests.java
  2. 2
      spring-beans/src/test/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHintsRegistrarTests.java
  3. 2
      spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java
  4. 2
      spring-context/src/test/java/org/springframework/context/aot/ReflectiveProcessorBeanRegistrationAotProcessorTests.java
  5. 4
      spring-core-test/src/main/java/org/springframework/aot/agent/InstrumentedMethod.java
  6. 5
      spring-core/src/main/java/org/springframework/aot/hint/predicate/ProxyHintsPredicates.java
  7. 10
      spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java
  8. 6
      spring-core/src/main/java/org/springframework/aot/hint/predicate/ResourceHintsPredicates.java
  9. 9
      spring-core/src/main/java/org/springframework/aot/hint/predicate/RuntimeHintsPredicates.java
  10. 5
      spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java
  11. 9
      spring-core/src/main/java/org/springframework/aot/hint/predicate/package-info.java
  12. 4
      spring-core/src/test/java/org/springframework/aot/hint/predicate/ProxyHintsPredicatesTests.java
  13. 7
      spring-core/src/test/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicatesTests.java
  14. 7
      spring-core/src/test/java/org/springframework/aot/hint/predicate/ResourceHintsPredicatesTests.java
  15. 5
      spring-core/src/test/java/org/springframework/aot/hint/predicate/SerializationHintsPredicatesTests.java
  16. 2
      spring-core/src/test/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHintsRegistrarTests.java
  17. 2
      spring-core/src/test/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHintsRegistrarTests.java
  18. 2
      spring-orm/src/test/java/org/springframework/orm/jpa/support/InjectionCodeGeneratorTests.java
  19. 2
      spring-tx/src/test/java/org/springframework/transaction/annotation/TransactionBeanRegistrationAotProcessorTests.java

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanRegistrationAotContributionTests.java

@ -28,7 +28,7 @@ import org.springframework.aot.generate.DefaultGenerationContext; @@ -28,7 +28,7 @@ import org.springframework.aot.generate.DefaultGenerationContext;
import org.springframework.aot.generate.InMemoryGeneratedFiles;
import org.springframework.aot.generate.MethodReference;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.aot.test.generator.compile.CompileWithTargetClassAccess;
import org.springframework.aot.test.generator.compile.Compiled;
import org.springframework.aot.test.generator.compile.TestCompiler;

2
spring-beans/src/test/java/org/springframework/beans/factory/annotation/JakartaAnnotationsRuntimeHintsRegistrarTests.java

@ -24,8 +24,8 @@ import org.junit.jupiter.api.Test; @@ -24,8 +24,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.beans.factory.aot.AotFactoriesLoader;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.util.ClassUtils;

2
spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java

@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.aot.generate.GeneratedMethods;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.aot.test.generator.compile.Compiled;
import org.springframework.aot.test.generator.compile.TestCompiler;
import org.springframework.beans.factory.config.BeanDefinition;

2
spring-context/src/test/java/org/springframework/context/aot/ReflectiveProcessorBeanRegistrationAotProcessorTests.java

@ -27,9 +27,9 @@ import org.junit.jupiter.api.Test; @@ -27,9 +27,9 @@ import org.junit.jupiter.api.Test;
import org.springframework.aot.generate.GenerationContext;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.TypeReference;
import org.springframework.aot.hint.annotation.Reflective;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
import org.springframework.beans.factory.aot.BeanRegistrationCode;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

4
spring-core-test/src/main/java/org/springframework/aot/agent/InstrumentedMethod.java

@ -28,8 +28,8 @@ import java.util.function.Predicate; @@ -28,8 +28,8 @@ import java.util.function.Predicate;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.TypeReference;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
/**
* Java method that is instrumented by the {@link RuntimeHintsAgent}.
@ -38,7 +38,7 @@ import org.springframework.aot.hint.TypeReference; @@ -38,7 +38,7 @@ import org.springframework.aot.hint.TypeReference;
* {@link #matcher(RecordedInvocation) is matching} the runtime behavior of the codebase.
*
* @author Brian Clozel
* @see org.springframework.aot.hint.RuntimeHintsPredicates
* @see RuntimeHintsPredicates
*/
enum InstrumentedMethod {

5
spring-core/src/main/java/org/springframework/aot/hint/ProxyHintsPredicates.java → spring-core/src/main/java/org/springframework/aot/hint/predicate/ProxyHintsPredicates.java

@ -14,11 +14,14 @@ @@ -14,11 +14,14 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.util.Arrays;
import java.util.function.Predicate;
import org.springframework.aot.hint.ProxyHints;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.TypeReference;
import org.springframework.util.Assert;
/**

10
spring-core/src/main/java/org/springframework/aot/hint/ReflectionHintsPredicates.java → spring-core/src/main/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicates.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.lang.reflect.Constructor;
import java.lang.reflect.Executable;
@ -26,6 +26,14 @@ import java.util.List; @@ -26,6 +26,14 @@ import java.util.List;
import java.util.Set;
import java.util.function.Predicate;
import org.springframework.aot.hint.ExecutableHint;
import org.springframework.aot.hint.ExecutableMode;
import org.springframework.aot.hint.FieldHint;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.ReflectionHints;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.TypeHint;
import org.springframework.aot.hint.TypeReference;
import org.springframework.core.MethodIntrospector;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

6
spring-core/src/main/java/org/springframework/aot/hint/ResourceHintsPredicates.java → spring-core/src/main/java/org/springframework/aot/hint/predicate/ResourceHintsPredicates.java

@ -14,13 +14,17 @@ @@ -14,13 +14,17 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import org.springframework.aot.hint.ResourceHints;
import org.springframework.aot.hint.ResourcePatternHint;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.TypeReference;
import org.springframework.util.Assert;
import org.springframework.util.ConcurrentLruCache;

9
spring-core/src/main/java/org/springframework/aot/hint/RuntimeHintsPredicates.java → spring-core/src/main/java/org/springframework/aot/hint/predicate/RuntimeHintsPredicates.java

@ -14,7 +14,14 @@ @@ -14,7 +14,14 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import org.springframework.aot.hint.ProxyHints;
import org.springframework.aot.hint.ReflectionHints;
import org.springframework.aot.hint.ResourceHints;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.SerializationHints;
/**
* Static generator of predicates that test whether the given {@link RuntimeHints}

5
spring-core/src/main/java/org/springframework/aot/hint/SerializationHintsPredicates.java → spring-core/src/main/java/org/springframework/aot/hint/predicate/SerializationHintsPredicates.java

@ -14,10 +14,13 @@ @@ -14,10 +14,13 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.util.function.Predicate;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.SerializationHints;
import org.springframework.aot.hint.TypeReference;
import org.springframework.util.Assert;
/**

9
spring-core/src/main/java/org/springframework/aot/hint/predicate/package-info.java

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
/**
* Predicate support for runtime hints.
*/
@NonNullApi
@NonNullFields
package org.springframework.aot.hint.predicate;
import org.springframework.lang.NonNullApi;
import org.springframework.lang.NonNullFields;

4
spring-core/src/test/java/org/springframework/aot/hint/ProxyHintsPredicatesTests.java → spring-core/src/test/java/org/springframework/aot/hint/predicate/ProxyHintsPredicatesTests.java

@ -14,13 +14,15 @@ @@ -14,13 +14,15 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.util.function.Predicate;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.RuntimeHints;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

7
spring-core/src/test/java/org/springframework/aot/hint/ReflectionHintsPredicatesTests.java → spring-core/src/test/java/org/springframework/aot/hint/predicate/ReflectionHintsPredicatesTests.java

@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.lang.reflect.Constructor;
@ -26,6 +26,11 @@ import org.junit.jupiter.api.BeforeAll; @@ -26,6 +26,11 @@ import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.ExecutableMode;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.TypeReference;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;

7
spring-core/src/test/java/org/springframework/aot/hint/ResourceHintsPredicatesTests.java → spring-core/src/test/java/org/springframework/aot/hint/predicate/ResourceHintsPredicatesTests.java

@ -14,13 +14,16 @@ @@ -14,13 +14,16 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import java.util.function.Predicate;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.TypeReference;
import static org.assertj.core.api.Assertions.assertThat;
/**
@ -54,7 +57,7 @@ class ResourceHintsPredicatesTests { @@ -54,7 +57,7 @@ class ResourceHintsPredicatesTests {
@Test
void resourcePatternMatchesTypeAndResourceName() {
this.runtimeHints.resources().registerPattern("/org/springframework/aot/hint/spring.*");
this.runtimeHints.resources().registerPattern("/org/springframework/aot/hint/predicate/spring.*");
assertPredicateMatches(resources.forResource(TypeReference.of(getClass()), "spring.properties"));
}

5
spring-core/src/test/java/org/springframework/aot/hint/SerializationHintsPredicatesTests.java → spring-core/src/test/java/org/springframework/aot/hint/predicate/SerializationHintsPredicatesTests.java

@ -14,10 +14,13 @@ @@ -14,10 +14,13 @@
* limitations under the License.
*/
package org.springframework.aot.hint;
package org.springframework.aot.hint.predicate;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.TypeReference;
import static org.assertj.core.api.Assertions.assertThat;
/**

2
spring-core/src/test/java/org/springframework/aot/hint/support/CoreAnnotationsRuntimeHintsRegistrarTests.java

@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test; @@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.core.annotation.AliasFor;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.support.SpringFactoriesLoader;

2
spring-core/src/test/java/org/springframework/aot/hint/support/SpringFactoriesLoaderRuntimeHintsRegistrarTests.java

@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test; @@ -21,8 +21,8 @@ import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.RuntimeHintsRegistrar;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.core.io.support.DummyFactory;
import org.springframework.core.io.support.MyDummyFactory1;
import org.springframework.core.io.support.SpringFactoriesLoader;

2
spring-orm/src/test/java/org/springframework/orm/jpa/support/InjectionCodeGeneratorTests.java

@ -26,7 +26,7 @@ import javax.lang.model.element.Modifier; @@ -26,7 +26,7 @@ import javax.lang.model.element.Modifier;
import org.junit.jupiter.api.Test;
import org.springframework.aot.hint.RuntimeHints;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.aot.test.generator.compile.Compiled;
import org.springframework.aot.test.generator.compile.TestCompiler;
import org.springframework.beans.testfixture.beans.TestBean;

2
spring-tx/src/test/java/org/springframework/transaction/annotation/TransactionBeanRegistrationAotProcessorTests.java

@ -22,7 +22,7 @@ import org.springframework.aop.SpringProxy; @@ -22,7 +22,7 @@ import org.springframework.aop.SpringProxy;
import org.springframework.aop.framework.Advised;
import org.springframework.aot.generate.GenerationContext;
import org.springframework.aot.hint.MemberCategory;
import org.springframework.aot.hint.RuntimeHintsPredicates;
import org.springframework.aot.hint.predicate.RuntimeHintsPredicates;
import org.springframework.beans.factory.aot.BeanRegistrationAotContribution;
import org.springframework.beans.factory.aot.BeanRegistrationCode;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;

Loading…
Cancel
Save