mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
9c8535f5e4
In Spring Framework 7.0, we introduced support for using `Optional` with the null-safe and Elvis operators in SpEL expressions; however, such expressions were previously not compilable. To address that, this commit introduces a new insertOptionalUnwrapIfNecessary() method in CodeFlow which effectively inserts byte code instructions for `myOptional.orElse(null)`, and the Elvis, Indexer, MethodReference, and PropertyOrFieldReference implementations have been modified to track the need to unwrap an `Optional` in compiled mode and delegate to insertOptionalUnwrapIfNecessary() accordingly. See gh-20433 See gh-36331 Closes gh-36330