Skip to content

Fix add missing method declaration when target is another CU#3076

Merged
jjohnstn merged 2 commits into
eclipse-jdt:masterfrom
jjohnstn:wrongmethod
Jul 10, 2026
Merged

Fix add missing method declaration when target is another CU#3076
jjohnstn merged 2 commits into
eclipse-jdt:masterfrom
jjohnstn:wrongmethod

Conversation

@jjohnstn

Copy link
Copy Markdown
Contributor
  • modify AddMissingMethodDeclarationFixCore to properly find the type of the ExpressionMethodReference instead of looking for an ancestor of the node
  • verify that the method binding doesn't already exist
  • use the target compilation unit rather than the compilation unit where the assist is started
  • modify QuickAssistProcessor.getAddMethodDeclaration() to create a special FixCorrectionProposal which specifies the target CU rather than the one in the assist context
  • add new test to AssistQuickFixTest1d8
  • fixes QuickFix for missing method creates one in wrong class #3061

What it does

See issue.

How to test

See issue or new test.

Author checklist

- modify AddMissingMethodDeclarationFixCore to properly find the
  type of the ExpressionMethodReference instead of looking for
  an ancestor of the node
- verify that the method binding doesn't already exist
- use the target compilation unit rather than the compilation unit
  where the assist is started
- modify QuickAssistProcessor.getAddMethodDeclaration() to create
  a special FixCorrectionProposal which specifies the target CU
  rather than the one in the assist context
- add new test to AssistQuickFixTest1d8
- fixes eclipse-jdt#3061
@jjohnstn jjohnstn self-assigned this Jul 10, 2026
@jjohnstn jjohnstn added the bug Something isn't working label Jul 10, 2026
@jjohnstn jjohnstn added this to the 4.41 M2 milestone Jul 10, 2026
@jjohnstn
jjohnstn merged commit 9e1646b into eclipse-jdt:master Jul 10, 2026
13 checks passed
@jjohnstn
jjohnstn deleted the wrongmethod branch July 10, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

QuickFix for missing method creates one in wrong class

1 participant