mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
folded functional expression: compare unprocessed types (IDEA-194333)
This commit is contained in:
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with qualifier" "true"
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Main {
|
||||
void test(List<List<String>> list) {
|
||||
Function<List<String>, Stream<String>> fn = List::stream;
|
||||
System.out.println(list.stream().flatMap(fn).count());
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with qualifier" "true"
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class Main {
|
||||
void test(List<List<String>> list) {
|
||||
Function<List<String>, Stream<String>> fn = List::stream;
|
||||
System.out.println(list.stream().flatMap(fn::a<caret>pply).count());
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -44,7 +44,8 @@ public class FunctionalExpressionCanBeFoldedInspection extends AbstractBaseJavaL
|
||||
if (qualifierExpression != null && referenceNameElement != null && !(qualifierExpression instanceof PsiSuperExpression)) {
|
||||
final PsiType qualifierType = qualifierExpression.getType();
|
||||
if (qualifierType != null) {
|
||||
final PsiType functionalInterfaceType = expression.getFunctionalInterfaceType();
|
||||
//don't get ground type as check is required over expected type instead
|
||||
final PsiType functionalInterfaceType = LambdaUtil.getFunctionalInterfaceType(expression, true);
|
||||
final PsiMethod interfaceMethod = LambdaUtil.getFunctionalInterfaceMethod(functionalInterfaceType);
|
||||
if (interfaceMethod != null) {
|
||||
final PsiElement resolve = resolver.get();
|
||||
|
||||
Reference in New Issue
Block a user