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

Gary Frost gfrost at openjdk.org
Mon Jan 5 13:32:14 UTC 2026


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)
);

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

Commit messages:
 - Make Op.setLocation fluent friendly by returning Op

Changes: https://git.openjdk.org/babylon/pull/811/files
  Webrev: https://webrevs.openjdk.org/?repo=babylon&pr=811&range=00
  Stats: 2 lines in 1 file changed: 1 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/babylon/pull/811.diff
  Fetch: git fetch https://git.openjdk.org/babylon.git pull/811/head:pull/811

PR: https://git.openjdk.org/babylon/pull/811


More information about the babylon-dev mailing list