On Wed, 24 Jan 2024 06:27:20 GMT, David Holmes <dhol...@openjdk.org> wrote:
>> I think of this as an expression that is always evaluated to the same value. >> The value itself is not interesting, it is the set of values that this >> expression can take that we are talking about. > > This seems really weird to me for Java code. The method doesn't get the > original "expression" it only gets the value of that expression after it has > been evaluated. Is there some kind of weird "magic" happening here? @dholmes-ora Indeed it's a compiler magic, albeit not really weird. While the method execution only receives the evaluated value of `expr`, the method compilation has the expression in its original form. As a result, it can determine the result based on this information. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17527#discussion_r1464415357