mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
lambda: take care of diamonds
This commit is contained in:
@@ -292,7 +292,17 @@ public class LambdaUtil {
|
||||
if (expression instanceof PsiCallExpression && ((PsiCallExpression)expression).getTypeArguments().length > 0) return true;
|
||||
if (expression instanceof PsiNewExpression) {
|
||||
final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)expression).getClassOrAnonymousClassReference();
|
||||
if (classReference != null && classReference.getTypeParameters().length > 0) return true;
|
||||
if (classReference != null) {
|
||||
final PsiReferenceParameterList parameterList = classReference.getParameterList();
|
||||
if (parameterList != null) {
|
||||
final PsiTypeElement[] typeParameterElements = parameterList.getTypeParameterElements();
|
||||
if (typeParameterElements.length > 0) {
|
||||
if (!(typeParameterElements[0].getType() instanceof PsiDiamondType)){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final PsiParameter[] lambdaParams = lambdaExpression.getParameterList().getParameters();
|
||||
if (lambdaParams.length != methodParameters.length) return false;
|
||||
|
||||
+1
@@ -8,6 +8,7 @@ public class BugReportLambdaSquiggles<T> {
|
||||
|
||||
static void bar( BugReportLambdaSquiggles<Integer> x) {
|
||||
x.flatMap(t1 -> new ArrayList<String>(t1));
|
||||
x.flatMap(t1 -> new ArrayList<>(t1));
|
||||
}
|
||||
|
||||
interface Mapper<T, U> {
|
||||
|
||||
Reference in New Issue
Block a user