@Override
  public List<ContextFilter> createFilters(Map args) {
    List<ContextFilter> result = new ArrayList<>();
    result.add(new PlaceContextFilter(PlatformPatterns.psiElement().inside(GrClosableBlock.class)));

    final ClosureScope scope = (ClosureScope)args.get("scope");

    if (scope.isArg()) {
      result.add(new PlaceContextFilter(
        PlatformPatterns.psiElement().inside(
        PlatformPatterns.psiElement(GrClosableBlock.class)
          .withParent(StandardPatterns.or(
            PlatformPatterns.psiElement(GrCall.class),
            PlatformPatterns.psiElement(GrArgumentList.class).withParent(GrCall.class))))));
    }

    if (scope.getMethodName() != null) {
      result.add(new PlaceContextFilter(PlatformPatterns.psiElement().inside(
        PlatformPatterns.psiElement(GrClosableBlock.class).withParent(
          StandardPatterns.or(GroovyPatterns.methodCall().withMethodName(scope.getMethodName()),
                              PlatformPatterns.psiElement(GrArgumentList.class)
                                .withParent(GroovyPatterns.methodCall().withMethodName(scope.getMethodName())))))));
    }

    if (scope.getAnnotationName() != null) {
      result.add(new PlaceContextFilter(PlatformPatterns.psiElement().inside(
        PlatformPatterns.psiElement(GrClosableBlock.class)
          .inside(GrAnnotationPattern.annotation().withQualifiedName(scope.getAnnotationName())))));
    }

    // Enhance only unqualified expressions
    String ctype = (String)args.get("ctype");
    if (ctype == null || ctype.isEmpty()) {
      result.add(ClassContextFilter.subtypeOf(GroovyCommonClassNames.GROOVY_LANG_CLOSURE));
    }

    return result;
  }
@Override
  public List<ContextFilter> createFilters(Map args)