You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2017/07/19 19:19:49 UTC

[50/50] [abbrv] tinkerpop git commit: TINKERPOP-1716 Excluded TranslationStrategy from Bytecode

TINKERPOP-1716 Excluded TranslationStrategy from Bytecode

TranslationStrategy is a special "test" strategy that is part of gremlin-test. No one would use that strategy directly. It's a bit of a hack but it is not included in Bytecode.


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

Branch: refs/heads/TINKERPOP-1716
Commit: a015c117453c93439180a5bbdccb327d125a1882
Parents: 63882a0
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Wed Jul 19 15:17:32 2017 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Wed Jul 19 15:17:32 2017 -0400

----------------------------------------------------------------------
 .../gremlin/process/traversal/Bytecode.java        | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/a015c117/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
index 7ea5f6f..0e621f1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Bytecode.java
@@ -68,8 +68,23 @@ public final class Bytecode implements Cloneable, Serializable {
                         (Class) arguments[i];
             }
             this.sourceInstructions.add(new Instruction(sourceName, classes));
-        } else
+        } else if (sourceName.equals(TraversalSource.Symbols.withStrategies)) {
+            final List<Object> list = new ArrayList<>();
+            for (int i = 0; i < arguments.length; i++) {
+                // HACK: ignore TranslationStrategy from gremlin-test - not registered to gryo and not needed in
+                // general usage in any way
+                if (!arguments[i].getClass().getName().equals("org.apache.tinkerpop.gremlin.process.traversal.strategy.decoration.TranslationStrategy")) {
+                    list.add(arguments[i]);
+                }
+            }
+
+            if (!list.isEmpty()) {
+                final Object[] classes = list.toArray(new Object[list.size()]);
+                this.sourceInstructions.add(new Instruction(sourceName, flattenArguments(classes)));
+            }
+        } else {
             this.sourceInstructions.add(new Instruction(sourceName, flattenArguments(arguments)));
+        }
         Bindings.clear();
     }