HotSpot Escape Analysis and Scalar Replacement Status
gist.github.com
gist.github.com
public int conditionalEscape(boolean cond1) {
otherMethod(cond1);
MyPair o = new MyPair(/*p1=*/1, /*p2=*/2);
return o.getP1();
}
the reference still never leaves conditionalEscape (i.e. it's not assigned to a variable outside the methods scope), there's just a layer of indirection.