boolean (final PsiTypeCastExpression typeCast) { if (!PsiUtil.isLanguageLevel7OrHigher(typeCast)) return false; // return type final PsiExpression operand = typeCast.getOperand(); if (operand instanceof PsiMethodCallExpression) { if (isPolymorphicMethod((PsiMethodCallExpression)operand)) return true; } // argument type final PsiElement exprList = PsiUtil.skipParenthesizedExprUp(typeCast.getParent()); if (exprList instanceof PsiExpressionList) { final PsiElement methodCall = exprList.getParent(); if (methodCall instanceof PsiMethodCallExpression) { if (isPolymorphicMethod((PsiMethodCallExpression)methodCall)) return true; } } return false; }