Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1670

End type lost when using promise()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.2.4
    • 3.2.5
    • process
    • None

    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

          Activity

            People

              spmallette Stephen Mallette
              andrew.tolbert Andy Tolbert
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: