From 52bffbff764237fe4d67c2964f279390838e106f Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Mon, 19 Sep 2022 21:54:04 -0700 Subject: [PATCH] Move `TestCompiler` and related classes to `core.test.tools` package Closes gh-29175 --- .../ScopedProxyBeanRegistrationAotProcessorTests.java | 4 ++-- ...AnnotationBeanRegistrationAotContributionTests.java | 6 +++--- .../aot/BeanDefinitionMethodGeneratorTests.java | 8 ++++---- .../BeanDefinitionPropertiesCodeGeneratorTests.java | 4 ++-- .../BeanDefinitionPropertyValueCodeGeneratorTests.java | 4 ++-- .../aot/BeanRegistrationsAotContributionTests.java | 6 +++--- .../aot/InstanceSupplierCodeGeneratorTests.java | 4 ++-- ...gurationClassPostProcessorAotContributionTests.java | 4 ++-- .../aot/ApplicationContextAotGeneratorTests.java | 4 ++-- ...pplicationContextAotGeneratorRuntimeHintsTests.java | 2 +- .../aot/test/generate/file/package-info.java | 9 --------- .../generate/file => core/test/tools}/ClassFile.java | 2 +- .../generate/file => core/test/tools}/ClassFiles.java | 2 +- .../test/tools}/CompilationException.java | 7 +------ .../test/tools}/CompileWithForkedClassLoader.java | 2 +- .../CompileWithForkedClassLoaderClassLoader.java | 2 +- .../tools}/CompileWithForkedClassLoaderExtension.java | 2 +- .../generate/compile => core/test/tools}/Compiled.java | 6 +----- .../test/tools}/DynamicClassFileObject.java | 2 +- .../test/tools}/DynamicClassLoader.java | 6 +----- .../generate/file => core/test/tools}/DynamicFile.java | 2 +- .../file => core/test/tools}/DynamicFileAssert.java | 2 +- .../file => core/test/tools}/DynamicFiles.java | 2 +- .../test/tools}/DynamicJavaFileManager.java | 6 +----- .../test/tools}/DynamicJavaFileObject.java | 4 +--- .../test/tools}/DynamicResourceFileObject.java | 2 +- .../file => core/test/tools}/ResourceFile.java | 2 +- .../file => core/test/tools}/ResourceFileAssert.java | 2 +- .../file => core/test/tools}/ResourceFiles.java | 2 +- .../generate/file => core/test/tools}/SourceFile.java | 2 +- .../file => core/test/tools}/SourceFileAssert.java | 2 +- .../generate/file => core/test/tools}/SourceFiles.java | 2 +- .../compile => core/test/tools}/TestCompiler.java | 9 +-------- .../file => core/test/tools}/WritableContent.java | 2 +- .../compile => core/test/tools}/package-info.java | 2 +- .../file => core/test/tools}/ClassFileTests.java | 2 +- .../file => core/test/tools}/ClassFilesTests.java | 2 +- .../test/tools}/CompilationExceptionTests.java | 6 +----- .../compile => core/test/tools}/CompiledTests.java | 7 +------ .../test/tools}/DynamicClassFileObjectTests.java | 2 +- .../test/tools}/DynamicJavaFileManagerTests.java | 6 +----- .../test/tools}/DynamicJavaFileObjectTests.java | 4 +--- .../test/tools}/DynamicResourceFileObjectTests.java | 2 +- .../file => core/test/tools}/ResourceFileTests.java | 2 +- .../file => core/test/tools}/ResourceFilesTests.java | 2 +- .../test/tools}/SourceFileAssertTests.java | 2 +- .../file => core/test/tools}/SourceFileTests.java | 10 +++++----- .../file => core/test/tools}/SourceFilesTests.java | 2 +- .../compile => core/test/tools}/TestCompilerTests.java | 8 +------- ...eManagedTypesBeanRegistrationAotProcessorTests.java | 4 ++-- .../orm/jpa/support/InjectionCodeGeneratorTests.java | 4 ++-- ...nnotationBeanPostProcessorAotContributionTests.java | 6 +++--- .../test/context/aot/AotIntegrationTests.java | 4 ++-- .../test/context/aot/TestContextAotGeneratorTests.java | 4 ++-- 54 files changed, 76 insertions(+), 132 deletions(-) delete mode 100644 spring-core-test/src/main/java/org/springframework/aot/test/generate/file/package-info.java rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/ClassFile.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/ClassFiles.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/CompilationException.java (84%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/CompileWithForkedClassLoader.java (96%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/CompileWithForkedClassLoaderClassLoader.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/CompileWithForkedClassLoaderExtension.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/Compiled.java (94%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicClassFileObject.java (97%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicClassLoader.java (95%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/DynamicFile.java (97%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/DynamicFileAssert.java (97%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/DynamicFiles.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicJavaFileManager.java (93%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicJavaFileObject.java (91%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicResourceFileObject.java (97%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/ResourceFile.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/ResourceFileAssert.java (94%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/ResourceFiles.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/SourceFile.java (99%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/SourceFileAssert.java (94%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/SourceFiles.java (98%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/TestCompiler.java (96%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/file => core/test/tools}/WritableContent.java (95%) rename spring-core-test/src/main/java/org/springframework/{aot/test/generate/compile => core/test/tools}/package-info.java (77%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/ClassFileTests.java (97%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/ClassFilesTests.java (98%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/CompilationExceptionTests.java (85%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/CompiledTests.java (94%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicClassFileObjectTests.java (96%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicJavaFileManagerTests.java (95%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicJavaFileObjectTests.java (91%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/DynamicResourceFileObjectTests.java (97%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/ResourceFileTests.java (96%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/ResourceFilesTests.java (98%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/SourceFileAssertTests.java (97%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/SourceFileTests.java (94%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/file => core/test/tools}/SourceFilesTests.java (98%) rename spring-core-test/src/test/java/org/springframework/{aot/test/generate/compile => core/test/tools}/TestCompilerTests.java (95%) diff --git a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyBeanRegistrationAotProcessorTests.java b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyBeanRegistrationAotProcessorTests.java index 1ce8b79868..b4a9feec95 100644 --- a/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyBeanRegistrationAotProcessorTests.java +++ b/spring-aop/src/test/java/org/springframework/aop/scope/ScopedProxyBeanRegistrationAotProcessorTests.java @@ -28,8 +28,6 @@ import org.springframework.aop.framework.AopInfrastructureBean; import org.springframework.aot.generate.MethodReference; import org.springframework.aot.generate.MethodReference.ArgumentCodeGenerator; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.aot.AotServices; import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution; @@ -43,6 +41,8 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.testfixture.beans.factory.aot.MockBeanFactoryInitializationCode; import org.springframework.beans.testfixture.beans.factory.generator.factory.NumberHolder; import org.springframework.core.ResolvableType; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanRegistrationAotContributionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanRegistrationAotContributionTests.java index 6cdb0392c5..bfa95b3c8a 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanRegistrationAotContributionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanRegistrationAotContributionTests.java @@ -27,9 +27,6 @@ import org.springframework.aot.generate.MethodReference; import org.springframework.aot.generate.MethodReference.ArgumentCodeGenerator; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.CompileWithForkedClassLoader; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.aot.BeanRegistrationAotContribution; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RegisteredBean; @@ -37,6 +34,9 @@ import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.testfixture.beans.factory.aot.MockBeanRegistrationCode; import org.springframework.core.env.Environment; import org.springframework.core.env.StandardEnvironment; +import org.springframework.core.test.tools.CompileWithForkedClassLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java index 9bc165da2f..aacf2f0f2f 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionMethodGeneratorTests.java @@ -32,10 +32,6 @@ import org.springframework.aot.generate.GenerationContext; import org.springframework.aot.generate.MethodReference; import org.springframework.aot.generate.MethodReference.ArgumentCodeGenerator; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.CompileWithForkedClassLoader; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; -import org.springframework.aot.test.generate.file.SourceFile; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConstructorArgumentValues.ValueHolder; import org.springframework.beans.factory.support.BeanDefinitionBuilder; @@ -49,6 +45,10 @@ import org.springframework.beans.testfixture.beans.TestBean; import org.springframework.beans.testfixture.beans.factory.aot.MockBeanRegistrationsCode; import org.springframework.core.ResolvableType; import org.springframework.core.mock.MockSpringFactoriesLoader; +import org.springframework.core.test.tools.CompileWithForkedClassLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.SourceFile; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java index 7e0d4dc6ed..e62354651f 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertiesCodeGeneratorTests.java @@ -30,8 +30,6 @@ import org.junit.jupiter.api.Test; import org.springframework.aot.generate.GeneratedClass; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanReference; @@ -44,6 +42,8 @@ import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.ManagedSet; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.testfixture.beans.factory.aot.DeferredTypeBuilder; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertyValueCodeGeneratorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertyValueCodeGeneratorTests.java index 11fd98eee3..ce2dec4a67 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertyValueCodeGeneratorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanDefinitionPropertyValueCodeGeneratorTests.java @@ -35,8 +35,6 @@ import org.junit.jupiter.api.Test; import org.springframework.aot.generate.GeneratedClass; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.config.BeanReference; import org.springframework.beans.factory.config.RuntimeBeanNameReference; import org.springframework.beans.factory.config.RuntimeBeanReference; @@ -45,6 +43,8 @@ import org.springframework.beans.factory.support.ManagedMap; import org.springframework.beans.factory.support.ManagedSet; import org.springframework.beans.testfixture.beans.factory.aot.DeferredTypeBuilder; import org.springframework.core.ResolvableType; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanRegistrationsAotContributionTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanRegistrationsAotContributionTests.java index bd2bba145e..dcc280c4d4 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanRegistrationsAotContributionTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/BeanRegistrationsAotContributionTests.java @@ -34,15 +34,15 @@ import org.springframework.aot.generate.MethodReference; import org.springframework.aot.generate.MethodReference.ArgumentCodeGenerator; import org.springframework.aot.test.generate.TestGenerationContext; import org.springframework.aot.test.generate.TestTarget; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; -import org.springframework.aot.test.generate.file.SourceFile; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.testfixture.beans.TestBean; import org.springframework.beans.testfixture.beans.factory.aot.MockBeanFactoryInitializationCode; import org.springframework.core.mock.MockSpringFactoriesLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.SourceFile; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGeneratorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGeneratorTests.java index e6c555020e..b18bc015f3 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGeneratorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/aot/InstanceSupplierCodeGeneratorTests.java @@ -31,8 +31,6 @@ import org.springframework.aot.hint.ExecutableMode; import org.springframework.aot.hint.ReflectionHints; import org.springframework.aot.hint.TypeHint; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.DefaultListableBeanFactory; @@ -51,6 +49,8 @@ import org.springframework.beans.testfixture.beans.factory.generator.factory.Num import org.springframework.beans.testfixture.beans.factory.generator.factory.SampleFactory; import org.springframework.beans.testfixture.beans.factory.generator.injection.InjectionComponent; import org.springframework.core.env.StandardEnvironment; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; import org.springframework.javapoet.ParameterizedTypeName; diff --git a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorAotContributionTests.java b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorAotContributionTests.java index 1c772b6154..38bb25c051 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorAotContributionTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/ConfigurationClassPostProcessorAotContributionTests.java @@ -31,8 +31,6 @@ import org.springframework.aot.generate.MethodReference; import org.springframework.aot.generate.MethodReference.ArgumentCodeGenerator; import org.springframework.aot.hint.ResourcePatternHint; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.BeansException; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution; @@ -49,6 +47,8 @@ import org.springframework.context.testfixture.context.generator.annotation.Impo import org.springframework.core.Ordered; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.io.ResourceLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.core.type.AnnotationMetadata; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.MethodSpec; diff --git a/spring-context/src/test/java/org/springframework/context/aot/ApplicationContextAotGeneratorTests.java b/spring-context/src/test/java/org/springframework/context/aot/ApplicationContextAotGeneratorTests.java index 22e84a63cc..a41db3d044 100644 --- a/spring-context/src/test/java/org/springframework/context/aot/ApplicationContextAotGeneratorTests.java +++ b/spring-context/src/test/java/org/springframework/context/aot/ApplicationContextAotGeneratorTests.java @@ -32,8 +32,6 @@ import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.TypeReference; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.BeansException; import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; import org.springframework.beans.factory.aot.BeanFactoryInitializationAotContribution; @@ -66,6 +64,8 @@ import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.core.env.Environment; import org.springframework.core.env.PropertySource; import org.springframework.core.io.ResourceLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-context/src/test/java/org/springframework/context/generator/ApplicationContextAotGeneratorRuntimeHintsTests.java b/spring-context/src/test/java/org/springframework/context/generator/ApplicationContextAotGeneratorRuntimeHintsTests.java index 7e0f274f91..6c5eec0691 100644 --- a/spring-context/src/test/java/org/springframework/context/generator/ApplicationContextAotGeneratorRuntimeHintsTests.java +++ b/spring-context/src/test/java/org/springframework/context/generator/ApplicationContextAotGeneratorRuntimeHintsTests.java @@ -25,7 +25,6 @@ import org.springframework.aot.test.agent.EnabledIfRuntimeHintsAgent; import org.springframework.aot.test.agent.RuntimeHintsInvocations; import org.springframework.aot.test.agent.RuntimeHintsRecorder; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.context.ApplicationContextInitializer; @@ -35,6 +34,7 @@ import org.springframework.context.support.GenericApplicationContext; import org.springframework.context.testfixture.context.generator.SimpleComponent; import org.springframework.context.testfixture.context.generator.annotation.AutowiredComponent; import org.springframework.context.testfixture.context.generator.annotation.InitDestroyComponent; +import org.springframework.core.test.tools.TestCompiler; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/package-info.java b/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/package-info.java deleted file mode 100644 index 02e9edfe63..0000000000 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/package-info.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Support classes for running assertions on generated files. - */ -@NonNullApi -@NonNullFields -package org.springframework.aot.test.generate.file; - -import org.springframework.lang.NonNullApi; -import org.springframework.lang.NonNullFields; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ClassFile.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFile.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ClassFile.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFile.java index f3b680bf7d..67fd32a6ca 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ClassFile.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFile.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.io.IOException; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ClassFiles.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFiles.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ClassFiles.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFiles.java index c17759c87e..28f1bd6538 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ClassFiles.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/ClassFiles.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Arrays; import java.util.Collections; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompilationException.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompilationException.java similarity index 84% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompilationException.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/CompilationException.java index 5ddf615fad..1bbc7bf9c0 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompilationException.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompilationException.java @@ -14,12 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; - -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; -import org.springframework.aot.test.generate.file.SourceFile; -import org.springframework.aot.test.generate.file.SourceFiles; +package org.springframework.core.test.tools; /** * Exception thrown when code cannot compile. diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoader.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoader.java similarity index 96% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoader.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoader.java index 630f0ee291..35307a2716 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoader.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.lang.annotation.Documented; import java.lang.annotation.ElementType; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoaderClassLoader.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoaderClassLoader.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java index d755979da8..3ff0513a8c 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoaderClassLoader.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderClassLoader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.IOException; import java.io.InputStream; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoaderExtension.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderExtension.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoaderExtension.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderExtension.java index 91d9fea7b5..27027b14e5 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/CompileWithForkedClassLoaderExtension.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/CompileWithForkedClassLoaderExtension.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.lang.reflect.Method; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/Compiled.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/Compiled.java similarity index 94% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/Compiled.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/Compiled.java index c1b692691f..a42a82b769 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/Compiled.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/Compiled.java @@ -14,17 +14,13 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; -import org.springframework.aot.test.generate.file.SourceFile; -import org.springframework.aot.test.generate.file.SourceFiles; import org.springframework.lang.Nullable; import org.springframework.util.Assert; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicClassFileObject.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicClassFileObject.java similarity index 97% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicClassFileObject.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicClassFileObject.java index 92bfb36533..6640ed7274 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicClassFileObject.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicClassFileObject.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicClassLoader.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicClassLoader.java similarity index 95% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicClassLoader.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicClassLoader.java index ff6bc1a8c6..15109ebf59 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicClassLoader.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicClassLoader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -29,10 +29,6 @@ import java.util.Map; import java.util.function.Function; import java.util.function.Supplier; -import org.springframework.aot.test.generate.file.ClassFile; -import org.springframework.aot.test.generate.file.ClassFiles; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; import org.springframework.lang.Nullable; import org.springframework.util.ReflectionUtils; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFile.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFile.java similarity index 97% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFile.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFile.java index 14681acadd..c64a1e1675 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFile.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFile.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFileAssert.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFileAssert.java similarity index 97% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFileAssert.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFileAssert.java index ecb86800dd..24fce58624 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFileAssert.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFileAssert.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import org.assertj.core.api.AbstractAssert; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFiles.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFiles.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFiles.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFiles.java index 92cc727311..01359ec16c 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/DynamicFiles.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicFiles.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Arrays; import java.util.Collections; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicJavaFileManager.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicJavaFileManager.java similarity index 93% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicJavaFileManager.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicJavaFileManager.java index 228ec53adc..e5780b4c70 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicJavaFileManager.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicJavaFileManager.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.IOException; import java.util.ArrayList; @@ -30,10 +30,6 @@ import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; import javax.tools.JavaFileObject.Kind; -import org.springframework.aot.test.generate.file.ClassFile; -import org.springframework.aot.test.generate.file.ClassFiles; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; import org.springframework.util.ClassUtils; /** diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicJavaFileObject.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicJavaFileObject.java similarity index 91% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicJavaFileObject.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicJavaFileObject.java index 86f1b97084..f6cd2a66e0 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicJavaFileObject.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicJavaFileObject.java @@ -14,15 +14,13 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.net.URI; import javax.tools.JavaFileObject; import javax.tools.SimpleJavaFileObject; -import org.springframework.aot.test.generate.file.SourceFile; - /** * Adapts a {@link SourceFile} instance to a {@link JavaFileObject}. * diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicResourceFileObject.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicResourceFileObject.java similarity index 97% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicResourceFileObject.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicResourceFileObject.java index e8de4da4a2..dcebb24e87 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/DynamicResourceFileObject.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/DynamicResourceFileObject.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFile.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFile.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFile.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFile.java index 4d4b50aad8..954587a257 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFile.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFile.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFileAssert.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFileAssert.java similarity index 94% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFileAssert.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFileAssert.java index 4534f5187a..305a566c51 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFileAssert.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFileAssert.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; /** * Assertion methods for {@code ResourceFile} instances. diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFiles.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFiles.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFiles.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFiles.java index 772524c62d..8805b9ab92 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/ResourceFiles.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/ResourceFiles.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Iterator; import java.util.stream.Stream; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFile.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java similarity index 99% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFile.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java index e9d7dd0f3a..ca0848d3a4 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFile.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFile.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.io.File; import java.io.FileInputStream; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFileAssert.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFileAssert.java similarity index 94% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFileAssert.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFileAssert.java index b991c72a59..4778ac4dd9 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFileAssert.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFileAssert.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; /** * Assertion methods for {@code SourceFile} instances. diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFiles.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFiles.java similarity index 98% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFiles.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFiles.java index 5aeb8ce030..15b428fcd5 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/SourceFiles.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/SourceFiles.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Iterator; import java.util.Objects; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/TestCompiler.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java similarity index 96% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/TestCompiler.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java index 44720df328..5d45c6ab5a 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/TestCompiler.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/TestCompiler.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.PrintStream; import java.util.ArrayList; @@ -35,13 +35,6 @@ import javax.tools.ToolProvider; import org.springframework.aot.generate.GeneratedFiles.Kind; import org.springframework.aot.generate.InMemoryGeneratedFiles; -import org.springframework.aot.test.generate.file.ClassFile; -import org.springframework.aot.test.generate.file.ClassFiles; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; -import org.springframework.aot.test.generate.file.SourceFile; -import org.springframework.aot.test.generate.file.SourceFiles; -import org.springframework.aot.test.generate.file.WritableContent; import org.springframework.lang.Nullable; /** diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/WritableContent.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/WritableContent.java similarity index 95% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/file/WritableContent.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/WritableContent.java index a2b538815b..877fa19159 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/file/WritableContent.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/WritableContent.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.io.IOException; diff --git a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/package-info.java b/spring-core-test/src/main/java/org/springframework/core/test/tools/package-info.java similarity index 77% rename from spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/package-info.java rename to spring-core-test/src/main/java/org/springframework/core/test/tools/package-info.java index 08968b64cd..a541c066c4 100644 --- a/spring-core-test/src/main/java/org/springframework/aot/test/generate/compile/package-info.java +++ b/spring-core-test/src/main/java/org/springframework/core/test/tools/package-info.java @@ -3,7 +3,7 @@ */ @NonNullApi @NonNullFields -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import org.springframework.lang.NonNullApi; import org.springframework.lang.NonNullFields; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ClassFileTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFileTests.java similarity index 97% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ClassFileTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFileTests.java index cb18a4330e..353c9dbdae 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ClassFileTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFileTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import org.junit.jupiter.api.Test; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ClassFilesTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFilesTests.java similarity index 98% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ClassFilesTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFilesTests.java index fd46e2602e..c43522bf06 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ClassFilesTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/ClassFilesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Iterator; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/CompilationExceptionTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/CompilationExceptionTests.java similarity index 85% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/CompilationExceptionTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/CompilationExceptionTests.java index 6ed7209ed6..724da13bed 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/CompilationExceptionTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/CompilationExceptionTests.java @@ -14,16 +14,12 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import org.junit.jupiter.api.Test; -import org.springframework.aot.test.generate.file.ResourceFiles; -import org.springframework.aot.test.generate.file.SourceFiles; - import static org.assertj.core.api.Assertions.assertThat; - /** * Tests for {@link CompilationException}. * diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/CompiledTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/CompiledTests.java similarity index 94% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/CompiledTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/CompiledTests.java index 59d85e2346..25daa6bb43 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/CompiledTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/CompiledTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.util.List; import java.util.concurrent.Callable; @@ -22,11 +22,6 @@ import java.util.function.Supplier; import org.junit.jupiter.api.Test; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; -import org.springframework.aot.test.generate.file.SourceFile; -import org.springframework.aot.test.generate.file.SourceFiles; - import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicClassFileObjectTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicClassFileObjectTests.java similarity index 96% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicClassFileObjectTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicClassFileObjectTests.java index 7c9bb6edb2..8b6c464a2a 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicClassFileObjectTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicClassFileObjectTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.ByteArrayInputStream; import java.io.OutputStream; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicJavaFileManagerTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileManagerTests.java similarity index 95% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicJavaFileManagerTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileManagerTests.java index b0d1a01357..5f6e244258 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicJavaFileManagerTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileManagerTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.IOException; import java.io.OutputStream; @@ -31,10 +31,6 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.springframework.aot.test.generate.file.ClassFile; -import org.springframework.aot.test.generate.file.ClassFiles; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; import org.springframework.util.StreamUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicJavaFileObjectTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileObjectTests.java similarity index 91% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicJavaFileObjectTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileObjectTests.java index f918f4695d..dbfc72a66a 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicJavaFileObjectTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicJavaFileObjectTests.java @@ -14,12 +14,10 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import org.junit.jupiter.api.Test; -import org.springframework.aot.test.generate.file.SourceFile; - import static org.assertj.core.api.Assertions.assertThat; /** diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicResourceFileObjectTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicResourceFileObjectTests.java similarity index 97% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicResourceFileObjectTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicResourceFileObjectTests.java index 6ab6376b64..2116788f7e 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/DynamicResourceFileObjectTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/DynamicResourceFileObjectTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.io.ByteArrayInputStream; import java.io.InputStream; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ResourceFileTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFileTests.java similarity index 96% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ResourceFileTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFileTests.java index 1d66885c4e..6c96a6201d 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ResourceFileTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFileTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import org.junit.jupiter.api.Test; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ResourceFilesTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFilesTests.java similarity index 98% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ResourceFilesTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFilesTests.java index 3f43472648..7d98747b60 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/ResourceFilesTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/ResourceFilesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Iterator; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFileAssertTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileAssertTests.java similarity index 97% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFileAssertTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileAssertTests.java index 1096c83343..cfbfb7c08b 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFileAssertTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileAssertTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import org.junit.jupiter.api.Test; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFileTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java similarity index 94% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFileTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java index d2d6d2b012..62a9e9e734 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFileTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFileTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.io.File; import java.io.IOException; @@ -88,15 +88,15 @@ class SourceFileTests { @Test void forClassWithClassUsesClass() { SourceFile sourceFile = SourceFile.forClass(new File("src/test/java"), SourceFileTests.class); - assertThat(sourceFile.getPath()).isEqualTo("org/springframework/aot/test/generate/file/SourceFileTests.java"); - assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.aot.test.generate.file.SourceFileTests"); + assertThat(sourceFile.getPath()).isEqualTo("org/springframework/core/test/tools/SourceFileTests.java"); + assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.core.test.tools.SourceFileTests"); } @Test void forTestClassWithClassUsesClass() { SourceFile sourceFile = SourceFile.forTestClass(SourceFileTests.class); - assertThat(sourceFile.getPath()).isEqualTo("org/springframework/aot/test/generate/file/SourceFileTests.java"); - assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.aot.test.generate.file.SourceFileTests"); + assertThat(sourceFile.getPath()).isEqualTo("org/springframework/core/test/tools/SourceFileTests.java"); + assertThat(sourceFile.getClassName()).isEqualTo("org.springframework.core.test.tools.SourceFileTests"); } @Test diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFilesTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFilesTests.java similarity index 98% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFilesTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFilesTests.java index f83b79a370..dce77f845c 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/file/SourceFilesTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/SourceFilesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.file; +package org.springframework.core.test.tools; import java.util.Iterator; diff --git a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/TestCompilerTests.java b/spring-core-test/src/test/java/org/springframework/core/test/tools/TestCompilerTests.java similarity index 95% rename from spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/TestCompilerTests.java rename to spring-core-test/src/test/java/org/springframework/core/test/tools/TestCompilerTests.java index 64984ec69c..e2a97d501c 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/test/generate/compile/TestCompilerTests.java +++ b/spring-core-test/src/test/java/org/springframework/core/test/tools/TestCompilerTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.aot.test.generate.compile; +package org.springframework.core.test.tools; import java.util.ArrayList; import java.util.List; @@ -30,12 +30,6 @@ import javax.lang.model.element.TypeElement; import com.example.PublicInterface; import org.junit.jupiter.api.Test; -import org.springframework.aot.test.generate.file.ClassFile; -import org.springframework.aot.test.generate.file.ResourceFile; -import org.springframework.aot.test.generate.file.ResourceFiles; -import org.springframework.aot.test.generate.file.SourceFile; -import org.springframework.aot.test.generate.file.SourceFiles; -import org.springframework.aot.test.generate.file.WritableContent; import org.springframework.core.io.ClassPathResource; import org.springframework.util.ClassUtils; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesBeanRegistrationAotProcessorTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesBeanRegistrationAotProcessorTests.java index 7c7ab44dd2..ea1893e1e4 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesBeanRegistrationAotProcessorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/persistenceunit/PersistenceManagedTypesBeanRegistrationAotProcessorTests.java @@ -27,8 +27,6 @@ import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; @@ -36,6 +34,8 @@ import org.springframework.context.annotation.Configuration; import org.springframework.context.aot.ApplicationContextAotGenerator; import org.springframework.context.support.GenericApplicationContext; import org.springframework.core.io.ResourceLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.orm.jpa.JpaVendorAdapter; import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import org.springframework.orm.jpa.domain.DriversLicense; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/InjectionCodeGeneratorTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/InjectionCodeGeneratorTests.java index f71007d724..60c41dc4ba 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/InjectionCodeGeneratorTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/InjectionCodeGeneratorTests.java @@ -27,11 +27,11 @@ import org.junit.jupiter.api.Test; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.predicate.RuntimeHintsPredicates; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.testfixture.beans.TestBean; import org.springframework.beans.testfixture.beans.TestBeanWithPrivateMethod; import org.springframework.beans.testfixture.beans.TestBeanWithPublicField; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.CodeBlock; import org.springframework.javapoet.JavaFile; import org.springframework.javapoet.MethodSpec; diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessorAotContributionTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessorAotContributionTests.java index 96db4669e1..b7c53bd660 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessorAotContributionTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessorAotContributionTests.java @@ -34,14 +34,14 @@ import org.junit.jupiter.api.Test; import org.springframework.aot.hint.TypeReference; import org.springframework.aot.test.generate.TestGenerationContext; -import org.springframework.aot.test.generate.compile.CompileWithForkedClassLoader; -import org.springframework.aot.test.generate.compile.Compiled; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.beans.factory.aot.BeanRegistrationAotContribution; import org.springframework.beans.factory.aot.BeanRegistrationCode; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.support.RegisteredBean; import org.springframework.beans.factory.support.RootBeanDefinition; +import org.springframework.core.test.tools.CompileWithForkedClassLoader; +import org.springframework.core.test.tools.Compiled; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.util.ReflectionUtils; import static org.assertj.core.api.Assertions.assertThat; diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java index 5a59a26cde..9069231e7e 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/AotIntegrationTests.java @@ -37,8 +37,8 @@ import org.opentest4j.MultipleFailuresError; import org.springframework.aot.AotDetector; import org.springframework.aot.generate.GeneratedFiles.Kind; import org.springframework.aot.generate.InMemoryGeneratedFiles; -import org.springframework.aot.test.generate.compile.CompileWithForkedClassLoader; -import org.springframework.aot.test.generate.compile.TestCompiler; +import org.springframework.core.test.tools.CompileWithForkedClassLoader; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.test.context.aot.samples.basic.BasicSpringJupiterSharedConfigTests; import org.springframework.test.context.aot.samples.basic.BasicSpringJupiterTests; import org.springframework.test.context.aot.samples.basic.BasicSpringTestNGTests; diff --git a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java index dd9a86f0f6..3f240444d4 100644 --- a/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java +++ b/spring-test/src/test/java/org/springframework/test/context/aot/TestContextAotGeneratorTests.java @@ -33,12 +33,12 @@ import org.springframework.aot.generate.InMemoryGeneratedFiles; import org.springframework.aot.hint.MemberCategory; import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.TypeReference; -import org.springframework.aot.test.generate.compile.CompileWithForkedClassLoader; -import org.springframework.aot.test.generate.compile.TestCompiler; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.core.env.Profiles; +import org.springframework.core.test.tools.CompileWithForkedClassLoader; +import org.springframework.core.test.tools.TestCompiler; import org.springframework.javapoet.ClassName; import org.springframework.test.context.BootstrapUtils; import org.springframework.test.context.MergedContextConfiguration;