Casting issue with Gremlin Java

I wrote the following query and I can't get it to compile, tried a ton of casting but it just isn't happy...

g.V(..).in(..).<some contraints that do not change it from a vertex).
        fold().project("visits", "form").
                    by(__.unfold().values("...").dedup().count()).
                    by(__.unfold().
                           repeat( __.in()).
                                    emit(__.<etc>))
                    

The problem is because of the fold it loses the type and then the type going into the repeat will not allow me to execute an in() step. I tried casting the unfold() and the in() to GraphTraversal<Vertex, Vertex> and variations of that with 1 vertex switched for Object. I cannot get this to compile. Anyone have any ideas on how to cast this properly?
Was this page helpful?