EA-55951 - CCE: StreamApiMigrationInspection$ReplaceWithForeachCallFix.applyFix

This commit is contained in:
Anna Kozlova
2014-04-16 19:19:20 +02:00
parent e7b3efbf80
commit e512a2f07a
3 changed files with 30 additions and 1 deletions
@@ -256,7 +256,10 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
final PsiIfStatement ifStmt = extractIfStatement(body);
String foreEachText = wrapInBlock(body);
String iterated = iteratedValue.getText();
String iterated = iteratedValue instanceof PsiCallExpression ||
iteratedValue instanceof PsiReferenceExpression ||
iteratedValue instanceof PsiQualifiedExpression ||
iteratedValue instanceof PsiParenthesizedExpression ? iteratedValue.getText() : "(" + iteratedValue.getText() + ")";
if (ifStmt != null) {
final PsiExpression condition = ifStmt.getCondition();
if (condition != null) {