This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch TINKERPOP-2280
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 3dc5d6927752e99f6b44d768f18568c38e44537d
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Tue Aug 13 08:56:39 2019 -0400

    TINKERPOP-2280 Changed toString of T
    
    Reduce confusion when T is in a Map and users overload property keys that 
match T instance names like "label" and "id".
---
 CHANGELOG.asciidoc                                                   | 1 +
 .../src/main/java/org/apache/tinkerpop/gremlin/structure/T.java      | 5 +++++
 .../org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java | 3 +++
 3 files changed, 9 insertions(+)

diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index b9c594d..e3aa66a 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ 
image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-3-9]]
 === TinkerPop 3.3.9 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Altered `T.toString()` to include the "T." prefix.
 
 [[release-3-3-8]]
 === TinkerPop 3.3.8 (Release Date: August 5, 2019)
diff --git 
a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/T.java 
b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/T.java
index a836840..0f1a985 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/T.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/T.java
@@ -95,6 +95,11 @@ public enum T implements Function<Element, Object> {
     @Override
     public abstract Object apply(final Element element);
 
+    @Override
+    public String toString() {
+        return "T." + name();
+    }
+
     public static T fromString(final String accessor) {
         if (accessor.equals(LABEL))
             return label;
diff --git 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
index 717e1bc..632a054 100644
--- 
a/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
+++ 
b/gremlin-groovy/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GroovyTranslator.java
@@ -33,6 +33,7 @@ import 
org.apache.tinkerpop.gremlin.process.traversal.util.ConnectiveP;
 import org.apache.tinkerpop.gremlin.process.traversal.util.OrP;
 import org.apache.tinkerpop.gremlin.structure.Edge;
 import org.apache.tinkerpop.gremlin.structure.Element;
+import org.apache.tinkerpop.gremlin.structure.T;
 import org.apache.tinkerpop.gremlin.structure.Vertex;
 import org.apache.tinkerpop.gremlin.structure.VertexProperty;
 import org.apache.tinkerpop.gremlin.structure.util.StringFactory;
@@ -182,6 +183,8 @@ public final class GroovyTranslator implements 
Translator.ScriptTranslator {
             return "VertexProperty.Cardinality." + object.toString();
         else if (object instanceof TraversalOptionParent.Pick)
             return "TraversalOptionParent.Pick." + object.toString();
+        else if (object instanceof T)
+            return "T." + ((T) object).name();
         else if (object instanceof Enum)
             return ((Enum) object).getDeclaringClass().getSimpleName() + "." + 
object.toString();
         else if (object instanceof Element) {

Reply via email to