PsiExpression (PsiExpression expression) { PsiExpression ancestor = expression; PsiElement parent = ancestor.getParent(); while (parent instanceof PsiParenthesizedExpression) { ancestor = (PsiExpression)parent; parent = ancestor.getParent(); } if (parent instanceof PsiPrefixExpression prefixAncestor) { if (JavaTokenType.EXCL.equals(prefixAncestor.getOperationTokenType())) { return prefixAncestor; } } return null; }