You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/04/26 17:59:04 UTC

[jira] [Commented] (TINKERPOP-1670) End type lost when using promise()

    [ https://issues.apache.org/jira/browse/TINKERPOP-1670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15985270#comment-15985270 ] 

ASF GitHub Bot commented on TINKERPOP-1670:
-------------------------------------------

GitHub user tolbertam opened a pull request:

    https://github.com/apache/tinkerpop/pull/604

    TINKERPOP-1670 Maintain Traversal type information in promise()

    For [TINKERPOP-1670](https://issues.apache.org/jira/browse/TINKERPOP-1670).
    
    Adds start and end step generic type information in the Traversal type
    that is input to the Function given to Traversal.promise().
    
    Also updates test to use full type information to ensure this change
    maintains the type information.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tolbertam/tinkerpop TINKERPOP-1670

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/604.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #604
    
----

----


> End type lost when using promise()
> ----------------------------------
>
>                 Key: TINKERPOP-1670
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1670
>             Project: TinkerPop
>          Issue Type: Bug
>          Components: process
>    Affects Versions: 3.2.4
>            Reporter: Andy Tolbert
>
> 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:
> {code:java}
> g.V().hasLabel("person").has("name", "marko").promise(Traversal::next);
> {code}
> Returns a {{CompletableFuture<Object>}} instead of {{CompletableFuture<Vertex>}}.
> {code:java}
> g.V().hasLabel("person").promise(Traversal::toList);
> {code}
> 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:
> {code:java}
> public default <T> CompletableFuture<T> promise(final Function<Traversal, T> traversalFunction)
> {code}
> to:
> {code:java}
> public default <T> CompletableFuture<T> promise(final Function<Traversal<S,E>, T> traversalFunction)
> {code}
> Need to test this a bit more though, but I think that should work.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)