PsiModifierListOwner (@Nullable PsiExpression expression) { expression = PsiUtil.skipParenthesizedExprDown(expression); if (expression instanceof PsiMethodCallExpression) { return ((PsiMethodCallExpression)expression).resolveMethod(); } if (expression instanceof PsiReferenceExpression) { PsiElement resolved = ((PsiReferenceExpression)expression).resolve(); if (resolved instanceof PsiModifierListOwner) { return (PsiModifierListOwner)resolved; } } return null; }