functional interface: introduce acceptability for both lambda and method references

This commit is contained in:
Anna Kozlova
2014-11-03 15:08:47 +01:00
parent 00b643ab5d
commit bb77beee3f
2 changed files with 10 additions and 0 deletions
@@ -25,4 +25,9 @@ public interface PsiFunctionalExpression extends PsiExpression, Iconable, Naviga
*/
@Nullable
PsiType getFunctionalInterfaceType();
/**
* @return true if assignment SAM s = expr is correctly shaped
*/
boolean isAcceptable(PsiType left);
}
@@ -167,6 +167,11 @@ public class PsiLambdaExpressionImpl extends ExpressionPsiElement implements Psi
return true;
}
@Override
public boolean isAcceptable(PsiType left) {
return isAcceptable(left, false);
}
@Override
public boolean isAcceptable(PsiType leftType, boolean checkReturnType) {
if (leftType instanceof PsiIntersectionType) {