Overview

After making this https://github.com/spring-projects/spring-framework/issues/29548#issuecomment-2009173805, I decided it's worthwhile to improve the names of classes generated by the SpEL compiler in any case.

Status Quo

The SpEL compiler currently generates classes in a package named spel with names following the pattern Ex#, where # is an index starting with 2 (which was simply an oversight).

This results in class names such as:

  • spel.Ex2
  • spel.Ex3
  • etc.

Goal

Generate 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
  • etc.

Related Issues

  • 29548

Comment From: jdomigon

Another interesting use case for us, would be, allowing to customize the package inside the spel code is generated. This would allow us to access using spel to package-private fields in some situations.

Comment From: sbrannen

This would allow us to access using spel to package-private fields in some situations.

@jdomigon, if you have valid use cases for accessing fields or methods which are currently package-private, please open a new issue (or issues) to discuss that separately.

Comment From: sbrannen

Another interesting use case for us, would be, allowing to customize the package inside the spel code is generated.

That is a likely outcome of #29548 since it would need to be configurable for AOT support.