Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1791

GremlinDsl custom step with generic end type produces invalid code in __.java

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.2.5
    • Fix Version/s: 3.2.7, 3.3.1
    • Component/s: process
    • Labels:
      None

      Description

      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:

      @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));
          }
      	
      }
      

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

      [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.__
      

      The generated code is this:

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

      I think the correct generated code should look like this:

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

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                spmallette stephen mallette
                Reporter:
                severin.stampler Severin Stampler
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: