mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
IDEA-162574 False positive 'Lambda can be replaced with method reference'
This commit is contained in:
@@ -298,8 +298,9 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
|
||||
return null;
|
||||
}
|
||||
PsiType type = typeElement.getType();
|
||||
if (type instanceof PsiPrimitiveType)
|
||||
return null;
|
||||
if (type instanceof PsiPrimitiveType) return null;
|
||||
type = type.getDeepComponentType();
|
||||
if (type instanceof PsiClassType && (((PsiClassType)type).resolve() instanceof PsiTypeParameter)) return null;
|
||||
return expression;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Bar extends Random {
|
||||
public void test(Object obj) {
|
||||
Function<Object, int[]> fn = int[].class::cast;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "true"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Bar extends Random {
|
||||
public void test(Object obj) {
|
||||
Function<Object, int[]> fn = s -> (int[])<caret>s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "false"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Bar extends Random {
|
||||
public void <T> test(Object obj) {
|
||||
Function<Object, T> fn = s -> (T)<caret>s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// "Replace lambda with method reference" "false"
|
||||
import java.util.function.Function;
|
||||
|
||||
class Bar extends Random {
|
||||
public void <T> test(Object obj) {
|
||||
Function<Object, T[]> fn = s -> (T[])<caret>s;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user