Prior to this commit, the SpEL compiler generated classes in a package named "spel" with names following the pattern "Ex#", where # was an index starting with 2. This resulted in class names such as: - spel.Ex2 - spel.Ex3 This commit improves the names of classes created by the SpEL compiler by generating classes in a package named "org.springframework.expression.spel.generated" with names following the pattern "CompiledExpression#####", where ##### is a 0-padded counter starting with 00001. This results in class names such as: - org.springframework.expression.spel.generated.CompiledExpression00001 - org.springframework.expression.spel.generated.CompiledExpression00002 This commit also moves the saveGeneratedClassFile() method from SpelCompilationCoverageTests to SpelCompiler and enhances it to: - Save classes in a "build/generated-classes" directory. - Convert package names to directories. - Create missing parent directories. - Use logging instead of System.out.println(). Running a test with saveGeneratedClassFile() enabled now logs something similar to the following. DEBUG o.s.e.s.s.SpelCompiler - Saving compiled SpEL expression [(#root.empty ? 0 : #root.size)] to [/Users/<username>/spring-framework/spring-expression/build/generated-classes/org/springframework/expression/spel/generated/CompiledExpression00001.class] Closes gh-32497 |
||
|---|---|---|
| .. | ||
| src | ||
| spring-expression.gradle | ||