-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Test AOT processing fails if a feature name prefix is reused #30861
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: bug
A general bug
Milestone
Comments
This was referenced Jul 11, 2023
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Jul 15, 2023
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Jul 15, 2023
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Jul 15, 2023
This commit introduces a `failOnError` flag in TestContextAotGenerator. When set to `true`, any error encountered during AOT processing will result in an exception that fails the overall process. When set to `false` (the default), the previous behavior remains unchanged: a DEBUG or WARN message will be logged, and processing will continue. This feature is currently only used for internal testing. See spring-projectsgh-30861 Closes spring-projectsgh-30898
sbrannen
added a commit
to sbrannen/spring-framework
that referenced
this issue
Jul 15, 2023
Prior to this commit, test AOT processing failed if a feature name for generated class names was used for more than one ApplicationContext. For example, when generating code for org.example.MessageService with a "Management" feature name, the "BeanDefinitions" class was named as follows (without a uniquely identifying TestContext###_ feature name prefix). org/example/MessageService__ManagementBeanDefinitions.java When another attempt was made to generate code for the MessageService using the same "Management" feature name, a FileAlreadyExistsException was thrown denoting that the class/file name was already in use. To avoid such naming collisions, this commit introduces a TestContextGenerationContext which provides a custom implementation of withName(String) that prepends an existing feature name (if present) to a new feature name, thereby treating any existing feature name as a prefix to a new, nested feature name. Consequently, code generation for the above example now results in unique class/file names like the following (which retain the uniquely identifying TestContext###_ prefixes). org/example/MessageService__TestContext002_ManagementBeanDefinitions.java org/example/MessageService__TestContext003_ManagementBeanDefinitions.java Closes spring-projectsgh-30861
sbrannen
added a commit
that referenced
this issue
Jul 15, 2023
sbrannen
added a commit
that referenced
this issue
Jul 15, 2023
This commit introduces a `failOnError` flag in TestContextAotGenerator. When set to `true`, any error encountered during AOT processing will result in an exception that fails the overall process. When set to `false` (the default), the previous behavior remains unchanged: a DEBUG or WARN message will be logged, and processing will continue. This feature is currently only used for internal testing. See gh-30861 Closes gh-30898
sbrannen
added a commit
that referenced
this issue
Jul 15, 2023
In order to reduce the surface area of published APIs in the affected classes, this commit: - Reverts the changes made to GeneratedClasses in c354b10. - Reverts the changes made to DefaultGenerationContext in a28ec3a. - Makes the DefaultGenerationContext(DefaultGenerationContext, String) constructor protected. - Reworks the internals of TestContextGenerationContext to align with the above changes. See gh-30861 Closes gh-30895 Closes gh-30897
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
in: test
Issues in the test module
theme: aot
An issue related to Ahead-of-time processing
type: bug
A general bug
Overview
For background, see #28974 (comment).
Related Issues
The text was updated successfully, but these errors were encountered: