Skip to content

fix: make isExtensionUpdateRequired uniformly public (widen over narrow)#1460

Merged
joaodinissf merged 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/align-extension-helper-visibility
Jul 13, 2026
Merged

fix: make isExtensionUpdateRequired uniformly public (widen over narrow)#1460
joaodinissf merged 1 commit into
dsldevkit:masterfrom
joaodinissf:fix/align-extension-helper-visibility

Conversation

@joaodinissf

Copy link
Copy Markdown
Collaborator

Problem

AbstractCheckExtensionHelper.isExtensionUpdateRequired is declared protected (a template-method hook, called only from the helper's own update flow), but five of its six subclasses have overridden it as public since the initial Check contribution (2016, e78f8113a) — Java permits an override to widen visibility, so the mismatch compiles silently. CheckMarkerHelpExtensionHelper is the lone protected override. The hierarchy carries two visibilities for one contract.

The trade-off, and the choice made

Two consistent end states were possible:

  • Narrow the public outliers to protected, matching the parent declaration. This is the textbook template-method shape — but CheckTocExtensionTest and CheckContextsExtensionTest have unit-tested the hook directly on injected helper instances since 2017, from a different bundle and package. Narrowing breaks those calls and forces test-only re-widening subclasses (~24 lines of scaffolding whose sole job is to undo the narrowing for tests).
  • Widen the parent declaration and the one remaining protected override to public. Two lines, no scaffolding, and it ratifies how the hierarchy has actually been designed and used for nine years: the predicate was evidently meant to be white-box testable from day one.

Widening was chosen — direct testability of the hook is a long-standing, deliberate part of this hierarchy's design, and the project generally accepts public where tests require it.

What this does

  • AbstractCheckExtensionHelper.isExtensionUpdateRequired: protectedpublic.
  • CheckMarkerHelpExtensionHelper.isExtensionUpdateRequired: protectedpublic (an override may not be narrower than its parent, so this follows necessarily).

Coordination note: #1397's helper refactor originally declared the two delegating overrides (CheckValidatorExtensionHelper, CheckQuickfixExtensionHelper) protected; it has been amended to keep them public so the build stays green in either merge order.

Verification

  • Repo-wide caller census: the only callers of isExtensionUpdateRequired are the parent's own update flow, CheckMarkerHelpExtensionHelper's super call, and the two tests — no behavior change is possible; this is a visibility-only change.
  • Full local gate (clean verify checkstyle:check pmd:pmd pmd:cpd pmd:check pmd:cpd-check spotbugs:check): BUILD SUCCESS.

🤖 Generated with Claude Code

…r hierarchy

AbstractCheckExtensionHelper declares isExtensionUpdateRequired as a
protected hook, but five of its six subclasses have overridden it as
public since the initial Check contribution, and CheckTocExtensionTest
and CheckContextsExtensionTest unit-test the hook directly on injected
helper instances. Widen the parent declaration and the one remaining
protected override (CheckMarkerHelpExtensionHelper) so the whole
hierarchy carries one visibility.

Widening was chosen over narrowing deliberately: narrowing the public
outliers would break the tests' direct calls and force test-only
re-widening subclasses, whereas public matches how the hierarchy has
actually been used since 2016.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018ANGM7L3BaEGfGUmPVKRt4
@joaodinissf
joaodinissf merged commit bddd981 into dsldevkit:master Jul 13, 2026
4 checks passed
@joaodinissf
joaodinissf deleted the fix/align-extension-helper-visibility branch July 13, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants