[java-inspections] IDEA-373515 Fix 'Collapse loop with stream forEach()' breaking when static star import is used

Thanks for help, Bas!

Co-authored-by: Bas Leijdekkers <bas.leijdekkers@jetbrains.com>

GitOrigin-RevId: 1ab70d08fe4a1ea0c050d725bc0ec5149d019b7c
This commit is contained in:
Bartek Pacia
2025-08-13 19:38:36 +00:00
committed by intellij-monorepo-bot
co-authored by Bas Leijdekkers
parent 07634e6b2d
commit 79ad940ac3
7 changed files with 107 additions and 1 deletions
@@ -457,7 +457,7 @@ final class TerminalBlock {
if (myStatements.length == 1) {
return myStatements[0];
}
PsiCodeBlock block = factory.createCodeBlock();
PsiCodeBlock block = factory.createCodeBlockFromText("{}", myVariable);
for (PsiStatement statement : myStatements) {
block.add(ct.markUnchanged(statement));
}