Pin ref-slot diff wire states and make Reference.value final - #8402
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Reference.asRefflyweight and settled the re-ADD semantics for changed ref-deduplicated slots. The DELETE, identical-value NO_CHANGE, and class-changed ADD paths of a ref-wrapped slot diff were equally corrupted by the old flyweight (both sides of the comparison collapsed onto one mutable wrapper) but have no wire-level regression coverage on main. This adds it, and hardensReferenceso the per-call-instance guarantee that Never CHANGE a ref-deduplicated RPC slot; re-ADD the new value #8392's semantics rely on is structural rather than comment-enforced.Summary
RpcSendQueueTest: three new tests pinning the wire states a diffed ref slot emits —deletedRefSlotIsSent(CHANGE, DELETE),identicalRefSlotIsNoChange(CHANGE, NO_CHANGE),changedRefSlotOfDifferentClassIsAdded(CHANGE, ADD) — including that the onChange consumer sees the after value (or is not invoked for DELETE/NO_CHANGE), via a smalldiffRefSlothelper that seeds the queue's before context the same way senders doReference.valueis nowfinal, assigned through a private constructor; a protected no-arg constructor keeps theGitProvenancesubclass compiling unchangedTest plan
./gradlew :rewrite-core:test --tests "org.openrewrite.rpc.RpcSendQueueTest"./gradlew :rewrite-core:test(coversGitProvenancemarker round trips against the constructor change)