[code-reflection] RFR: Represents literals of type byte/short as permitted in the Java language [v2]
Mourad Abbay
mabbay at openjdk.org
Wed Mar 12 23:24:14 UTC 2025
On Wed, 12 Mar 2025 18:20:32 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Ah ok - I see:
>>
>> case CLASS -> numericOneValue(types.unboxedType(t));
>>
>>
>> So, `numericOneValue` also does unboxing. I think this code would be clearer by doing the unboxing first -- and then pass the unboxed type to both `numericOneValue` and `convert` (and then, we could remove the unboxing path from `numericOneValue` - and make that consistent with `defaultValue`).
>
>> and make that consistent with `defaultValue`).
>
> Strike that -- `defaultValue` also allows `nulls`. Anyway -- `numericOneValue` should only work on primitives, I think.
For `defaultValue`, the passed type can be primitive or reference. For `numericOneValue` we can only accept a numerical primitive type, as value 1 doesn't make any senses for other types.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/351#discussion_r1992421421
More information about the babylon-dev
mailing list