mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +07:00
migration to stream api: disable for raw types (IDEA-140095)
This commit is contained in:
+2
-1
@@ -109,7 +109,8 @@ public class StreamApiMigrationInspection extends BaseJavaBatchLocalInspectionTo
|
||||
}
|
||||
|
||||
if (ExceptionUtil.getThrownCheckedExceptions(new PsiElement[] {body}).isEmpty()) {
|
||||
if (isCollectCall(body, statement.getIterationParameter())) {
|
||||
if (!(iteratedValueType instanceof PsiClassType && ((PsiClassType)iteratedValueType).isRaw()) &&
|
||||
isCollectCall(body, statement.getIterationParameter())) {
|
||||
holder.registerProblem(iteratedValue, "Can be replaced with collect call",
|
||||
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new ReplaceWithCollectCallFix());
|
||||
} else if (!isTrivial(body, statement.getIterationParameter())) {
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// "Replace with forEach" "false"
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors
|
||||
|
||||
class A {
|
||||
public static <T> List<T> toTypedList1(Collection collection, Class<T> aClass) {
|
||||
if (collection.size() == 0) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<T> result = new ArrayList<>(collection.size());
|
||||
|
||||
for (Object obj : coll<caret>ection) {
|
||||
result.add(aClass.cast(obj));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user