From 5c96c794edba67bd0086eb184c766812ca4192bb Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Mon, 5 Aug 2024 10:48:31 +0200 Subject: [PATCH] Java: fix one more case where "invert if" loses comment (IDEA-252033) GitOrigin-RevId: 8bba0c15ca98a31a29ffc8a0d46effca9d96d27f --- .../intention/impl/InvertIfConditionAction.java | 16 ++++++++++++++-- .../afterCommentAfterThenBlockStatement.java | 11 +++++++++++ .../beforeCommentAfterThenBlockStatement.java | 10 ++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/invertIfCondition/afterCommentAfterThenBlockStatement.java create mode 100644 java/java-tests/testData/codeInsight/invertIfCondition/beforeCommentAfterThenBlockStatement.java diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java index cfc3a6f42a7f..08c77e7877a5 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java @@ -237,8 +237,8 @@ public final class InvertIfConditionAction extends PsiUpdateModCommandAction { + break; + } // THIS COMMENT DISAPPEARS + } + } +} \ No newline at end of file