This project demonstrates the reproducibility of spring-framework#33936, where running the AOT (Ahead-of-Time) processing results in a StackOverflowError.
To reproduce the StackOverflowError, run the following command:
./gradlew aotClasses
This will trigger the AOT processing and produce the stack overflow error due to infinite recursion.
The issue is caused by the commit 357dbc0, which introduced a recursive processAheadOfTime method without a condition to break the recursion. This leads to an infinite recursive loop and eventually a StackOverflowError.
To resolve the issue, add a condition to break the infinite recursive loop by keeping track of the classes that have already been validated.
if (validatedClasses.contains(clazz)) {
// Break the infinite recursive loop
logger.debug("Class {} has already been validated.", clazz.getName());
return;
}
This approach is demonstrated in the following code snippet from the example project: