[code-reflection] RFR: Enable sealing of an operation [v11]

Paul Sandoz psandoz at openjdk.org
Wed Aug 27 15:51:59 UTC 2025


On Wed, 27 Aug 2025 11:21:17 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Allow for an unbound operation to be sealed, causing it to be copied when we append it to a block builder.
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Document Op.seal and Op.isSealed

See also the `setLocation` method.

src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 313:

> 311:     @Override
> 312:     public final Block parent() {
> 313:         if (isSealed() || result == null) {

Update the doc.

src/jdk.incubator.code/share/classes/jdk/incubator/code/Op.java line 550:

> 548:      * and causes the operation to be copied when we append it to a {@link Block.Builder}.
> 549:      * @throws IllegalStateException If this operation is bound.
> 550:      * @implSpec This implementation is idempotent.

Suggested doc:


Seals this operation. After this operation is sealed its {@link #result result} and {@link #parent parent} are guaranteed to always be {@code null}.
<p> 
If a sealed operation is {@link Block.Builder#op appended} to a {@link Block.Builder} then it is 
treated as if the operation is bound, and therefore the sealed operation will be transformed.
<p>
Sealing is idempotent if the operation is already sealed.
@throws IllegalStateException if this operation is bound.


Use of `@implSpec` is not required,  idempotency is a property of the API specification and not the implementation specification.

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

PR Review: https://git.openjdk.org/babylon/pull/425#pullrequestreview-3160419258
PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2304383504
PR Review Comment: https://git.openjdk.org/babylon/pull/425#discussion_r2304420708


More information about the babylon-dev mailing list