@Override
    public Expression<?> visit(Path<?> expr, Context context) {
        if (expr.getMetadata().getPathType() == PathType.COLLECTION_ANY) {
            Path<?> parent = (Path<?>) expr.getMetadata().getParent().accept(this, context);
            expr = ExpressionUtils.path(expr.getType(), PathMetadataFactory.forCollectionAny(parent));
            EntityPath<?> replacement = new EntityPathBase<Object>(expr.getType(),
                    ExpressionUtils.createRootVariable(expr, replacedCounter++));
            context.add(expr, replacement);
            return replacement;

        } else if (expr.getMetadata().getParent() != null) {
            Context c = new Context();
            Path<?> parent = (Path<?>) expr.getMetadata().getParent().accept(this, c);
            if (c.replace) {
                context.add(c);
                return replaceParent(expr, parent);
            }
        }
        return expr;
    }
{@code CollectionAnyVisitor} is an expression visitor which transforms any() path expressions which are
often transformed into subqueries

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/support/CollectionAnyVisitor.java