On Fri, 8 May 2026 20:49:11 GMT, Serguei Spitsyn <[email protected]> wrote:
>> You understand your requirements better than I do, but I would think the >> invariants you're trying to preserve need to work on all class files, >> javac-generated or not? > > The invariant about slot of `this` object was set a long time ago when JVMTI > was introduced. Now is not a good time to change it. We normally keep the > spec and implementation compatible if possible. I _think_ the new invariant here is that a value object must never be observed to mutate (because if that happened, it would be in an implementation-dependent way, and may not be reproducible). If that needs to be strongly guaranteed, then you need to guard against unexpected but valid bytecode shapes. If it's not really an invariant, and we're just doing this for user convenience, then it makes sense to design for conventional use and not worry about non-standard bytecode patterns. (One way to think about this: how bad would it be if this cloning thing didn't happen at all? What would break?) ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2412#discussion_r3211485503
