disable stream api conversion on iterable (IDEA-124222)

This commit is contained in:
Anna Kozlova
2014-04-23 17:28:46 +02:00
parent 6ca89ebc43
commit 209d176ea6
2 changed files with 16 additions and 1 deletions

View File

@@ -76,7 +76,7 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
final PsiStatement body = statement.getBody();
if (iteratedValue != null && body != null) {
final PsiType iteratedValueType = iteratedValue.getType();
if (InheritanceUtil.isInheritor(iteratedValueType, CommonClassNames.JAVA_LANG_ITERABLE)) {
if (InheritanceUtil.isInheritor(iteratedValueType, CommonClassNames.JAVA_UTIL_COLLECTION)) {
final PsiClass iteratorClass = PsiUtil.resolveClassInType(iteratedValueType);
LOG.assertTrue(iteratorClass != null);
try {

View File

@@ -0,0 +1,15 @@
// "Replace with forEach" "false"
import java.util.ArrayList;
import java.util.List;
class Sample {
Iterable<String> foo = new ArrayList<>();
String foo(){
for (String s : fo<caret>o) {
if (s == null) {
return s;
}
}
return null;
}
}