mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-17 16:39:29 +00:00
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