Skip to content

Syncing refactoring of JUnitXFramework - #15

Merged
VISTALL merged 2 commits into
consulo:masterfrom
unv-unv:refactoring
Jul 21, 2026
Merged

Syncing refactoring of JUnitXFramework#15
VISTALL merged 2 commits into
consulo:masterfrom
unv-unv:refactoring

Conversation

@unv-unv

@unv-unv unv-unv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@unv-unv

unv-unv commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@claude review pr with inline comments

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown

Claude finished @unv-unv's task in 2m 36s —— View job


PR Review: Syncing refactoring of JUnitXFramework

  • Read PR diff
  • Read changed files & repo conventions
  • Analyze changes
  • Post inline review comments

I've left 4 inline comments on the diff (with one-click suggestion blocks where applicable).

Overall assessment ✅

This is a clean API-modernization sync and looks correct. Nice changes:

  • AllIcons.RunConfigurations.JunitPlatformIconGroup.runconfigurationsJunit() — matches the icon-group API used elsewhere.
  • hasModifierProperty(PsiModifier.PUBLIC/STATIC)isPublic() / isStatic() — more readable.
  • ApplicationManager.getApplication()Application.get(), CommonBundle.getWarningTitle()CommonLocalize.titleWarning().get(), Messages.getWarningIcon()UIUtil.getWarningIcon() — consistent with the current platform/localization APIs.
  • Adding @RequiredWriteAction (both files) and @RequiredUIAccess (JUnit4, since it may pop the showOkCancelDialog) correctly documents the threading contract. The asymmetry is right: JUnit3's variant doesn't show a dialog, so it only needs @RequiredWriteAction.

Notes (all minor / non-blocking)

  1. Mixed tabs/spaces on the newly added annotation lines in both files — @Nullable is tab-indented while the added @Override / @RequiredWriteAction / @RequiredUIAccess lines use 4 spaces. Suggested tab normalization inline.
  2. Annotation order — JUnit4 now has @Nullable before @Override, while JUnit3 keeps @Override before @Nullable. Worth aligning the two for consistency (suggestion inline).
  3. Dialog message in JUnit4Framework is still a hardcoded English string (and reads "already exist""already exists"). Since the title was just localized, the message could follow via a LocalizeValue — optional.

None of these affect correctness; the PR is good to merge as-is if you'd rather defer the style nits.
· branch refactoring

Comment on lines 104 to 108
@Nullable
@Override
@RequiredUIAccess
@RequiredWriteAction
protected PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation & annotation order. These new annotation lines mix tabs and spaces (@Nullable is tab-indented, the others use 4 spaces), and the @Override/@Nullable order is flipped relative to JUnit3Framework#findOrCreateSetUpMethod. Normalizing to tabs and putting @Override first keeps the two frameworks consistent.

Suggested change
@Nullable
@Override
@RequiredUIAccess
@RequiredWriteAction
protected PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException
@Override
@Nullable
@RequiredUIAccess
@RequiredWriteAction
protected PsiMethod findOrCreateSetUpMethod(PsiClass clazz) throws IncorrectOperationException

Comment on lines +115 to +117
@RequiredUIAccess
@RequiredWriteAction
private PsiMethod findOrCreateSetUpMethod(PsiClass clazz, String beforeClassAnnotationName, String beforeAnnotationName)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: these two annotations are space-indented while the rest of the file uses tabs.

Suggested change
@RequiredUIAccess
@RequiredWriteAction
private PsiMethod findOrCreateSetUpMethod(PsiClass clazz, String beforeClassAnnotationName, String beforeAnnotationName)
@RequiredUIAccess
@RequiredWriteAction
private PsiMethod findOrCreateSetUpMethod(PsiClass clazz, String beforeClassAnnotationName, String beforeAnnotationName)

Comment on lines +136 to +141
int exit = Application.get().isUnitTestMode() ? Messages.OK :
Messages.showOkCancelDialog(
"Method setUp already exist but is not annotated as @Before. Annotate?",
CommonLocalize.titleWarning().get(),
UIUtil.getWarningIcon()
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that CommonLocalize supplies the dialog title, the message argument is still a hardcoded English string (which also reads "already exist" — should be "already exists"). Consider moving it to a LocalizeValue to match the rest of the localization migration. Non-blocking.

Comment on lines +157 to +159
@Override
@Nullable
@RequiredWriteAction

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: mixed tabs/spaces here — @Override and @RequiredWriteAction use 4 spaces while @Nullable uses a tab. Normalizing to tabs matches the rest of the file.

Suggested change
@Override
@Nullable
@RequiredWriteAction
@Override
@Nullable
@RequiredWriteAction

@VISTALL
VISTALL merged commit 409dd4c into consulo:master Jul 21, 2026
1 check passed
@unv-unv
unv-unv deleted the refactoring branch July 21, 2026 20:25
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