You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tinkerpop.apache.org by "Stephen Mallette (Jira)" <ji...@apache.org> on 2020/11/17 19:17:00 UTC

[jira] [Closed] (TINKERPOP-2474) withSack() Groovy translation output could be simplified

     [ https://issues.apache.org/jira/browse/TINKERPOP-2474?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Stephen Mallette closed TINKERPOP-2474.
---------------------------------------
    Fix Version/s: 3.4.9
                   3.5.0
       Resolution: Done

This was some basic refactoring to get rid of some hackery in the {{GroovyTranslator}} which eliminates some explicit casting:

{code}
gremlin> g.withSack({1.0d}, {it + 1}).V().sack()
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
gremlin> g.withSack(1.0d, {it + 1}).V().sack()
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
gremlin> g.withSack(1.0d, {x,y -> x + 1}).V().sack()
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
gremlin> g.withSack({1.0d}, {x,y -> x + 1}).V().sack()
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
==>1.0
{code}

Implemented as CTR here:

https://github.com/apache/tinkerpop/commit/70ade8ccb9ffd7121df188d8abd9f0250473472a


> withSack() Groovy translation output could be simplified
> --------------------------------------------------------
>
>                 Key: TINKERPOP-2474
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-2474
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: groovy
>    Affects Versions: 3.4.8
>            Reporter: Stephen Mallette
>            Assignee: Stephen Mallette
>            Priority: Major
>             Fix For: 3.5.0, 3.4.9
>
>
> There is a bunch of hackery to generate:
> {code}
> g.withSack((java.util.function.Supplier) {1.0d}, (java.util.function.UnaryOperator) {it + 1}).
>   V().sack()
> {code}
> It would be nice if that was just:
> {code}
> g.withSack({1.0d}, {it + 1}).V().sack()
> {code}
> in earlier version we get this:
> {code}
> gremlin> g.withSack(1.0d, {it + 1}).V().sack()
> Ambiguous method overloading for method org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource#withSack.
> Cannot resolve which method to invoke for [class java.lang.Double, class groovysh_evaluate$_run_closure1] due to overlapping prototypes between:
> 	[class java.lang.Object, interface java.util.function.BinaryOperator]
> 	[class java.lang.Object, interface java.util.function.UnaryOperator]
> Type ':help' or ':h' for help.
> Display stack trace? [yN]n
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)