PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(PsiElement element) { final IElementType tokenType; if (element instanceof PsiPrefixExpression prefixExpression) { tokenType = prefixExpression.getOperationTokenType(); if (prefixExpression.getOperand() == null) { return false; } } else if (element instanceof PsiPostfixExpression postfixExpression) { tokenType = postfixExpression.getOperationTokenType(); } else { return false; } return JavaTokenType.PLUSPLUS.equals(tokenType) || JavaTokenType.MINUSMINUS.equals(tokenType); } }; }