Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Cannot Reproduce
-
3.0.7
-
None
-
None
Description
In trying to work around some generics bugs that I think have patches for upcoming versions, I discovered a more basic problem with the STC. I'm having trouble with a standalone reproduction, but I can repro in situ.
I'm putting together a Gremlin traversal (pretty generics-heavy). Gremlin defines this method, with no constraints on A:
public static <A> GraphTraversal<A, A> start()
I am trying to feed this to a custom method defined on a Java interface:
<A extends Element, E2> GraphTraversal<A, Map<Object, E2>> selectProperties(GraphTraversal<A, Vertex> gt);
The solution is that the first A is Vertex. However, the simple invocation
p.selectProperties(__.start())
triggers the STC error
Cannot call <A extends org.apache.tinkerpop.gremlin.structure.Element,E2> com.example.Projector#selectProperties(org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal <A, org.apache.tinkerpop.gremlin.structure.Vertex>) with arguments [org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversal <A extends java.lang.Object, A extends java.lang.Object>]
This is a bug but I think already in fixing. The problem I am reporting is that even an explicit type witness, which should tell the STC what it needs, is ignored:
p.selectProperties(__.<Vertex,Vertex>start())
This produces the same error as above, specifically including the unbound A extends Object instead of the explicit Vertex.