Updated ternary expression that could be misleading for those unfamiliar with Groovy's Elvis operator semantics. Also added a caution snippet to distinguish the varying interpretations and reinforce the expected behavior in SpEL.

Comment From: simonbasle

Thanks @mmanashirov for pointing that subtlety. As @sbrannen has pointed out, the wording in the change is not entirely accurate but the concern is valid. I'll treat it more as a ticket than a PR and will come up with a satisfactory wording in a separate commit, closing this as superseded. No more action required on your part πŸ‘

Comment From: mmanashirov

Thanks for pointing out that this behavior is specific to Strings. After experiencing a slight burn as a result of this behavior on Strings, I made the false assumption that it consistently behaves according to Groovy's rules for other types as well. You just saved me from another burn in the future! Thank you.

Comment From: simonbasle

  • Superseded by #30352

Comment From: sbrannen

Thanks for pointing out that this behavior is specific to Strings.

You're welcome.

After experiencing a slight burn as a result of this behavior on Strings,

I can totally see how you got burned by that: it was an undocumented "feature".

I made the false assumption that it consistently behaves according to Groovy's rules for other types as well.

Well, you know what they say about assumptions... <fill in the blank>

I still recall what my 10th grade history teacher told my class about assumptions. Though I don't think it's appropriate to quote that here. πŸ˜‡

Comment From: mmanashirov

We must have had the same 10th grade history teacher. πŸ˜‚