PsiElement (@NotNull PsiKeyword keyword, @NotNull Class<?> parentClass) { return new PsiMatcherImpl(keyword) .dot(PsiMatchers.hasText(PsiModifier.STATIC)) .parent(PsiMatchers.hasClass(PsiModifierList.class)) .parent(PsiMatchers.hasClass(parentClass)) .parent(PsiMatchers.hasClass(PsiClass.class)) .dot(JavaMatchers.hasModifier(PsiModifier.STATIC, false)) .parent(PsiMatchers.hasClass(PsiClass.class, PsiDeclarationStatement.class, PsiNewExpression.class, PsiEnumConstant.class)) .getElement(); }