Skip to content

Conversation

@jjohnstn
Copy link
Contributor

  • add checks in ModifierCorrectionSubProcessorCore.getAddMethodModifierProposal() to look for adding static to an annotation and if it is well-known junit annotations that don't allow static just return
  • add new tests to ModifierCorrectionsQuickFixTest
  • fixes Don't recommend static methods for unit test methods #2761

What it does

Doesn't propose adding static to a method that uses well-known junit annotations such as Test, BeforeEach, Before....

How to test

See issue or new tests.

Author checklist

- add checks in
  ModifierCorrectionSubProcessorCore.getAddMethodModifierProposal()
  to look for adding static to an annotation and if it is well-known
  junit annotations that don't allow static just return
- add new tests to ModifierCorrectionsQuickFixTest
- fixes eclipse-jdt#2761
@jjohnstn jjohnstn self-assigned this Jan 31, 2026
@jjohnstn jjohnstn added the bug Something isn't working label Jan 31, 2026
@jjohnstn jjohnstn added this to the 4.39 M3 milestone Jan 31, 2026
@jjohnstn jjohnstn merged commit f99d557 into eclipse-jdt:master Jan 31, 2026
13 checks passed
@jjohnstn jjohnstn deleted the nostaticjunit branch January 31, 2026 18:16
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.

Don't recommend static methods for unit test methods

1 participant