fix(refactoring): single createChange() call and consistent error filtering #96
No reviewers
Labels
No labels
bug
build
enhancement
headless
P1-critical
P2-high
P3-medium
P4-low
refactoring
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ai-tools/jdt-mcp-server!96
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/61-51-refactoring-status"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
createChange()was called twice per invocation (once in the preview branch,once in the execute branch) in
extractMethod,moveType, both inlinevariants,
changeMethodSignature,encapsulateFieldandintroduceParameter— same statement duplicated on both sides of the preview/execute split.
Computed once now, branch on
previewOnlyafterwards.encapsulateFieldandintroduceParametergated on rawstatus.hasError()instead of
RefactoringSupport.getRealErrors(), unlike every otherrefactoring method here — headless-mode participant/potential-match noise
could get reported as a blocking error. Both now filter through
getRealErrors()like the rest of the file.Closes #61
Closes #51
Basis
Stacked on PR #95 (
fix/79-move-type-cross-module), not yet merged tomain.Diff should be reviewed against that branch, not
main.Test plan
mvn clean compileafter branch switch (avoid stale-target/phantom errors)mvn -pl org.naturzukunft.jdt.mcp -am compilemvn clean package(product build, once)tests/refactoring-test.shagainst the packaged binary — 2/2 passed (alsore-confirms #79/#77 from the stacked base)
tests/smoke-test.shagainst the packaged binary — 9/9 passedjdt_encapsulate_fieldred/green check against a fixture-parentcopy: temporarily reverted only the
getRealErrors()line, rebuilt,confirmed the code path in question; restored, rebuilt, confirmed
identical diff to the committed fix (see "Hürden" note below for why a
true false-positive repro wasn't reachable)
Found while verifying, not part of this fix
jdt_encapsulate_fieldthrows an unconditionalNullPointerExceptioninheadless mode on every call, unrelated to #51/#61:
ProjectTemplateStore.load()→fInstanceStoreisnullwhen JDT tries torender the generated getter/setter body from the code-template store
(
SelfEncapsulateFieldRefactoring.checkFinalConditions()→addGetterSetterChanges()→createGetterMethod()). Happens before thestatus.hasError()/getRealErrors()check this PR touches is ever reached,so a true end-to-end false-positive repro for #51 wasn't reachable — verified
the logic is correct and consistent with the rest of the file instead. This
predates this PR and needs its own issue (headless-mode template-store
bootstrapping).