[code-reflection] RFR: Externalizable operations

Paul Sandoz psandoz at openjdk.org
Wed May 1 15:17:18 UTC 2024


On Wed, 1 May 2024 11:31:01 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Rename `OpWithDefinition` to `ExternalizableOp` and specify as an operation whose contents may be externalized.
>> Rename `OpDefintion` to `ExternalOpContents`, an instance of which represents the external contents of an operation.
>> An externaliziable operation may be constructed from its external contents, for example by using an operation factory. 
>> 
>> The method `Op::attributes` is removed, and the method is defined on `ExternalizableOp`. The attribute map returned by the method is the external representation of specific contents of an operation.
>
> src/java.base/share/classes/java/lang/reflect/code/op/ExternalOpContent.java line 48:
> 
>> 46:  * thereby separating the specifics of deserializing from construction.
>> 47:  */
>> 48: public record ExternalOpContent(String name,
> 
> Wouldn't `ExternalizedOp` or `SerializedOp` be better - e.g. more akin to `SerializedLambda` ?

I nearly chose `ExternalizedOp` but thought it looked to similar to `ExternalizableOp`. But, most of the time one operates the former. I will rename to `ExternalizedOp` and also enclose it within `ExternalizableOp`.

Leaning into this, in a following PR I will add abstract externalizable op types classes for grouping the core and extended ops. 

We can probably apply the same patterns to `TypeElement` and `TypeDefinition` in a following PR.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/62#discussion_r1586410042


More information about the babylon-dev mailing list