chore(api): InvalidatingNodeRegistry ensureOpen + negative test + NodeRegistry @since note (J2/J3/J4)#121
Merged
Conversation
…eRegistry @SInCE note (J2/J3/J4) Three small carry-over items from the v1.6.7 senior review, bundled into one PR because they share a topic (the I3 auto-invalidating registry wrapper) and a CHANGELOG section. J2 — symmetric closed-session behaviour: InvalidatingNodeRegistry.register now calls ensureOpen() before super.register(). Previously the two registration entry points (session.registry().register and session.registerNodeDefinition) disagreed on what happens after session.close(): the dedicated method threw IllegalStateException, the registry().register path silently mutated and invalidated a closed-session cache. After J2 both throw the same exception type with the same message. ensureOpen() inside the constructor's default- definitions setup is safe because the `closed` flag is field- initialised to false before the constructor body runs. J3 — negative test: DocumentSessionTest.registryRegisterOnClosedSessionThrowsIllegalStateException pins the new contract. Pairs with the existing positive cache- invalidation test from I3 so the senior-bar "positive + negative" pattern (cf PR-7.3) is complete. J4 — NodeRegistry @SInCE note: Class-level Javadoc on NodeRegistry now explicitly calls out the v1.6.7 non-final relaxation. The class became non-final in v1.6.7 (Track I3) so DocumentSession could install the auto- invalidating subclass; the change was already binary-compatible (japicmp: semver PATCH). The Javadoc just makes the rationale discoverable without reading the CHANGELOG. Test plan: - DocumentSessionTest now has 26 tests (25 prev + 1 new negative). - ./mvnw verify -pl . -P japicmp — 1058 tests, 0 failures. japicmp vs v1.6.7 baseline: semver PATCH (compatible — no public signature changes; ensureOpen() is a behavioural strengthening on an existing public method, well-known semver-PATCH territory).
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.
Summary
Three small carry-over items from the v1.6.7 senior review,
bundled into one PR because they share a topic (the I3 auto-
invalidating registry wrapper) and a CHANGELOG section.
J2 — Symmetric closed-session behaviour
InvalidatingNodeRegistry.registernow callsensureOpen()before
super.register(). Previously the two registration entrypoints disagreed on what happens after
session.close():session.registerNodeDefinition(...)IllegalStateExceptionIllegalStateExceptionsession.registry().register(...)IllegalStateExceptionensureOpen()inside the constructor's default-definitions setupis safe because the
closedflag is field-initialised tofalsebefore the constructor body runs.
J3 — Negative test
DocumentSessionTest.registryRegisterOnClosedSessionThrowsIllegalStateExceptionpins the new contract. Pairs with the existing positive cache-
invalidation test from I3 so the senior-bar "positive + negative"
pattern (cf PR-7.3)
is complete.
J4 —
NodeRegistry@sincenoteClass-level Javadoc on
NodeRegistrynow explicitly calls outthe v1.6.7 non-final relaxation. The class became non-final in
v1.6.7 (Track I3) so
DocumentSessioncould install the auto-invalidating subclass; the change was already binary-compatible
(japicmp:
semver PATCH). The Javadoc just makes the rationalediscoverable without reading the CHANGELOG.
Test plan
DocumentSessionTestnow has 26 tests (25 prev + 1 newnegative).
./mvnw verify -pl . -P japicmp— 1058 tests, 0 failures.semver PATCH(compatible — nopublic signature changes;
ensureOpen()is a behaviouralstrengthening on an existing public method).