PsiMethodReferenceExpression (ChainContext context, String text) { PsiTypeCastExpression castExpr = (PsiTypeCastExpression)context.createExpression("(" + myType.getCanonicalText() + ")" + text); PsiMethodReferenceExpression methodRef = (PsiMethodReferenceExpression)castExpr.getOperand(); LOG.assertTrue(methodRef != null); return methodRef; }