[ 
https://issues.apache.org/jira/browse/TINKERPOP-1791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16211912#comment-16211912
 ] 

stephen mallette commented on TINKERPOP-1791:
---------------------------------------------

Took a quick stab at trying to fix this problem but a simple solution didn't 
present itself too well. Was hoping for an easy way to override the type 
parameters with some configuration options provided as annotations on the DSL 
method itself, but i'm not sure that's a good way to do it (plus it didn't 
quite work the way i wanted).Will need to re-think this a bit as I'm not seeing 
a fast easy fix.

> 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