Severin Stampler created TINKERPOP-1791:
-------------------------------------------

             Summary: GremlinDsl custom step with generic end type produces 
invalid code in __.java
                 Key: TINKERPOP-1791
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1791
             Project: TinkerPop
          Issue Type: Bug
          Components: process
    Affects Versions: 3.2.5
            Reporter: Severin Stampler


I'm trying the create a custom step to perform a full-text search in an 
external index and return the matching vertices or edges, like this:

{code:java}
@GremlinDsl(traversalSource = 
"com.saillabs.mediaminer.mmgraphdsl.MMGraphTraversalSourceDsl")
public interface MMGraphTraversalDsl<S, E> extends GraphTraversal.Admin<S, E> {

        public default GraphTraversal<S, E> search(String field, String query) {
                //TODO:
                // Find vertex ids matching the search query in external index
                
                Set<String> vids = new HashSet<>();
                // for now add some hardcoded vertex ids
                vids.add("vertex1");
                vids.add("vertex2");
                
        return hasId(P.within(vids));
    }
        
}
{code}

The code seems correct in my point of view, but the generated code in the 
__.java is not compilable. It produces this error:


{noformat}
[ERROR] 
/C:/svn/start/mm/mmserver/server/mvn/mmgraphdsl/target/generated-sources/annotations/com/saillabs/mediaminer/mmgraphdsl/__.java:[41,41]
 cannot find symbol
[ERROR] symbol:   class E
[ERROR] location: class com.saillabs.mediaminer.mmgraphdsl.__
{noformat}

The generated code is this:


{code:java}
public static <S> MMGraphTraversal<S, E> search(String field, String query) {
    return __.<S>start().search(field,query);
  }
{code}

I think the correct generated code should look like this:


{code:java}
public static <S> MMGraphTraversal<S, S> search(String field, String query) {
    return __.<S>start().search(field,query);
  }
{code}

I think it's a bug in the GremlinDsl code generator, however, I may be wrong. 
Any help is appreciated.
Thanks, br
Severin



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to