[code-reflection] RFR: Make Op.setLocation fluent friendly by returning Op

Paul Sandoz psandoz at openjdk.org
Mon Jan 5 20:28:25 UTC 2026


On Mon, 5 Jan 2026 13:24:15 GMT, Gary Frost <gfrost at openjdk.org> wrote:

> This one change simplifies a bunch of code. 
> 
> We frequently had this pattern 
> 
> var opToReplace = .....;
> var  newOp = new MyNewOp(...);
> newOp.setLocation(opToReplace.getLocation());
> builder.op(newOp);
> 
> We were forced to catch the newOp just to set its location.
> 
> This change allows 
> 
> builder.op( new myNewOp(....)
>      .setLocation(opToReplace)
> );

Looks good. Can you update the JavaDoc?

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

PR Review: https://git.openjdk.org/babylon/pull/811#pullrequestreview-3628306366


More information about the babylon-dev mailing list