PsiNewExpression (PsiExpression expression) { if (expression instanceof PsiNewExpression) { return (PsiNewExpression)expression; } else if (expression instanceof PsiReferenceExpression referenceExpression) { final PsiExpression definition = DeclarationSearchUtils.findDefinition(referenceExpression, null); if (!(definition instanceof PsiNewExpression)) { return null; } return (PsiNewExpression) definition; } return null; }