From 5fac316fdcd36455280ef5f7cd5156d5f155c805 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 18 Feb 2011 20:07:53 +0100 Subject: [PATCH] IDEA-65704 ("Replace for-each loop with indexed for loop" breaks code) --- .../ReplaceForEachLoopWithIndexedForLoopIntention.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/IntentionPowerPak/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java b/plugins/IntentionPowerPak/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java index cb3bace8866f..2b255c1969aa 100644 --- a/plugins/IntentionPowerPak/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java +++ b/plugins/IntentionPowerPak/src/com/siyeh/ipp/forloop/ReplaceForEachLoopWithIndexedForLoopIntention.java @@ -1,5 +1,5 @@ /* - * Copyright 2003-2010 Dave Griffith, Bas Leijdekkers + * Copyright 2003-2011 Dave Griffith, Bas Leijdekkers * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -181,7 +181,8 @@ public class ReplaceForEachLoopWithIndexedForLoopIntention extends Intention { PsiExpression expression, PsiElement context) { if (expression instanceof PsiMethodCallExpression || expression instanceof PsiTypeCastExpression || - expression instanceof PsiArrayAccessExpression) { + expression instanceof PsiArrayAccessExpression || + expression instanceof PsiNewExpression) { final String variableName = getVariableName(expression); return createVariable(variableName, expression, context); } else if (expression instanceof PsiParenthesizedExpression) {