Description
The Traversal.promise method loses type information when used so the type of the returned future is not as complete as it could be.
For example:
g.V().hasLabel("person").has("name", "marko").promise(Traversal::next);
Returns a CompletableFuture<Object> instead of CompletableFuture<Vertex>.
g.V().hasLabel("person").promise(Traversal::toList);
Returns a CompletableFuture<List> instead of CompletableFuture<List<Vertex>.
The fix for this could be as simple as adding the start and end (S,E) types to the traversal that is the input of the function:
public default <T> CompletableFuture<T> promise(final Function<Traversal, T> traversalFunction)
to:
public default <T> CompletableFuture<T> promise(final Function<Traversal<S,E>, T> traversalFunction)
Need to test this a bit more though, but I think that should work.
Attachments
Issue Links
- links to