GroovyMethodCallPattern (final ElementPattern<String> names, final String className) { return GroovyMethodCallPattern.INSTANCE.withMethodName(names).withMethod( psiMethod().with(new PatternCondition<>("psiMethodClassNameCondition") { @Override public boolean accepts(@NotNull PsiMethod psiMethod, ProcessingContext context) { PsiClass containingClass = psiMethod.getContainingClass(); if (containingClass != null) { if (InheritanceUtil.isInheritor(containingClass, className)) { return true; } } return false; } }) ); }