CTR: fixed `has(T accessor, Object value, Object... values)` which didn't take 
into account that `value` can be an array.

Prior this fix we've had this behavior:

```
gremlin> labels = ["software","person"] as String[]
==>software
==>person
gremlin> g.V().hasLabel(labels)
gremlin> g.V().hasLabel("software","person")
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
```

Now it's:

```
gremlin> labels = ["software","person"] as String[]
==>software
==>person
gremlin> g.V().hasLabel(labels)
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
gremlin> g.V().hasLabel("software","person")
==>v[1]
==>v[2]
==>v[3]
==>v[4]
==>v[5]
==>v[6]
```


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/dea8e841
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/dea8e841
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/dea8e841

Branch: refs/heads/TINKERPOP-1280
Commit: dea8e84194f619aad7aab3d52f6e0e16974985f2
Parents: 13782aa
Author: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Authored: Tue Sep 13 21:24:09 2016 +0200
Committer: Daniel Kuppitz <daniel_kupp...@hotmail.com>
Committed: Tue Sep 13 21:24:09 2016 +0200

----------------------------------------------------------------------
 .../traversal/dsl/graph/GraphTraversal.java      | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/dea8e841/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
----------------------------------------------------------------------
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
index e0956c5..1aa5000 100644
--- 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
+++ 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/dsl/graph/GraphTraversal.java
@@ -968,10 +968,21 @@ public interface GraphTraversal<S, E> extends 
Traversal<S, E> {
     }
 
     public default GraphTraversal<S, E> has(final T accessor, final Object 
value, final Object... values) {
-        if (values.length == 0) return has(accessor, value);
-        final Object[] objects = new Object[values.length + 1];
-        objects[0] = value;
-        System.arraycopy(values, 0, objects, 1, values.length);
+        final Object[] objects;
+        if (value instanceof Object[]) {
+            final Object[] arr = (Object[]) value;
+            if (values.length == 0) {
+                objects = arr;
+            } else {
+                objects = new Object[arr.length + values.length];
+                System.arraycopy(arr, 0, objects, 0, arr.length);
+                System.arraycopy(values, 0, objects, arr.length, 
values.length);
+            }
+        } else {
+            objects = new Object[values.length + 1];
+            objects[0] = value;
+            System.arraycopy(values, 0, objects, 1, values.length);
+        }
         return has(accessor, P.within(objects));
     }
 

Reply via email to