[code-reflection] RFR: Enhance grammar of op attributes
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed May 28 17:11:02 UTC 2025
On Wed, 28 May 2025 16:17:52 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:
>> This PR enhances the grammar of op attributes, so as to avoid use of "stringy" attributes where possible. Now all attributes that are Java primitives are externalized and re-parsed back automatically. This means that op factories no longer need to test for attribute values of type `String` and then manually parse that string back into the correct primitive, which makes the code more robust.
>>
>> This change caused some reshuffling in the tests -- most notably, when fixing the triton test, the new logic highlighted what was probably an "issue" in the triton transformer (see related comment).
>
> src/jdk.incubator.code/share/classes/jdk/incubator/code/op/CoreOp.java line 1281:
>
>> 1279:
>> 1280: static Object processConstantValue(TypeElement t, Object value) {
>> 1281: if (t.equals(JavaType.BOOLEAN) && value instanceof Boolean) {
>
> Nice. Can the IDE refactor the body of this method to a switch expression?
We can't really -- because the switch is on `JavaType` constant (and we don't support constant patterns -- at least yet :-) ). So, at least "as written", we can't easily turn this into a switch.
-------------
PR Review Comment: https://git.openjdk.org/babylon/pull/435#discussion_r2112379040
More information about the babylon-dev
mailing list