[code-reflection] RFR: Represents literals of type byte/short as permitted in the Java language [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Mar 12 18:20:14 UTC 2025


On Wed, 12 Mar 2025 17:58:59 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Before this PR, we had literals of type byte/short in the code model, but that's not permitted by the Java language. In Java, a literals of type byte/short is a literal of type int + conversion to the type byte/short.
>
> Mourad Abbay has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
> 
>  - Merge branch 'code-reflection' into fix-literal-type
>  - Represents literals of type byte/short as permitted in the Java language.

src/jdk.incubator.code/share/classes/jdk/incubator/code/internal/ReflectMethods.java line 2332:

> 2330:                     // Capture applying rhs and operation
> 2331:                     Function<Value, Value> scanRhs = (lhs) -> {
> 2332:                         Value one = convert(append(numericOneValue(tree.type)), types.unboxedType(tree.type));

I don't get the call to `types.uboxedType` -- `tree.type` is passed to `numericOneValue` which seems to assume that the type is a primitive type, right?

-------------

PR Review Comment: https://git.openjdk.org/babylon/pull/351#discussion_r1992055213


More information about the babylon-dev mailing list