Github user okram commented on the issue:

    https://github.com/apache/tinkerpop/pull/372
  
    I believe there is an easier solution. However, you don't provide a test 
case so I don't know if it works. 
    
    CHANGE:
    
    ```
    @Override
            public Edge addEdge(final String label, final Vertex inVertex, 
final Object... keyValues) {
                final Edge edge = this.addOutEdge(label, inVertex, keyValues);
                if (inVertex.equals(this)) {
                    if(null == this.inEdges)
                        this.inEdges = new HashMap<>();
                    List<Edge> inE = this.inEdges.get(label);
                    if (null == inE) {
                        inE = new ArrayList<>();
                        this.inEdges.put(label, inE);
                    }
                    inE.add(edge);
                }
                return edge;
            }
    ```
    
    TO
    
    ```
     @Override
            public Edge addEdge(final String label, final Vertex inVertex, 
final Object... keyValues) {
                final Edge edge = this.addOutEdge(label, inVertex, keyValues);
                if (inVertex.equals(this)) {
                    if (ElementHelper.getIdValue(keyValues).isPresent())
                        this.addInEdge(label, this, keyValues);
                    else {
                        final Object[] keyValuesWithId = 
Arrays.copyOf(keyValues,keyValues.length+2);
                        keyValuesWithId[keyValuesWithId.length - 2] = T.id;
                        keyValuesWithId[keyValuesWithId.length - 1] = edge.id();
                        this.addInEdge(label, this, keyValuesWithId);
                    }
                }
                return edge;
            }
    ```
    
    Note that when I do this, all the current tests in TinkerPop pass 
(`StarGraphTest`). Moreover, I added a test case to `StarGraphTest` that uses a 
`GraphFilter`. I hope it tests what you want it to (when I didn't change the 
method, the test still passes :| -- thus, you may need to add a test to ensure 
we get failure without the new method addEdge method).
    
    https://github.com/apache/tinkerpop/tree/TINKERPOP-1397
    
    Finally, I think that you might think that bothE() would only return the 
edge once, it shouldn't. It should return it twice. If that is the 
misunderstanding, then this is NOT an issue.
    
    ```
    gremlin> g.V(0l).bothE()
    ==>e[1][0-self->0]
    ==>e[1][0-self->0]
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to