[
https://issues.apache.org/jira/browse/TINKERPOP-3015?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17933466#comment-17933466
]
ASF GitHub Bot commented on TINKERPOP-3015:
-------------------------------------------
Cole-Greer opened a new pull request, #3068:
URL: https://github.com/apache/tinkerpop/pull/3068
https://issues.apache.org/jira/browse/TINKERPOP-3015
Update hasId(P) signature to accept P<?> instead of P<Object>. This allows
for types such as P<String> which are not subtypes of P<Object> to be passed
directly to this method, instead of going through the hasId(Object) overload
and then casting to a P raw type. Note that the P special case handling still
exists in hasId(Object) to cover any cases in which the correct overload is not
identifiable at compile-time.
All of the above applies equivalently for hasValue().
This is non-breaking and targeting 3.7-dev as all it is doing is allowing
more predicates to go into hasId(P) directly, and skipping the cast to the P
raw-type.
My vote is VOTE +1
> Use wildcard instead of Object for hasId predicates
> ---------------------------------------------------
>
> Key: TINKERPOP-3015
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3015
> Project: TinkerPop
> Issue Type: Improvement
> Components: process
> Affects Versions: 3.5.7, 3.6.5
> Reporter: Christopher Smith
> Priority: Minor
>
> From both {{GraphTraversal}} and {{__}}, the {{hasId(P)}} steps specify a
> {{P<Object>}}. Common predicates, such as {{within}}, propagate the generic
> type from their own arguments, so that this produces a compile-time error:
> {code}
> Collection<String> ids = ...
> g.V().hasId(P.within(ids))
> {code}
> I believe that without loss of safety, the signature in both locations could
> be changed to {{P<?>}}, making the typical case of "here's a collection of
> IDs of known type" work smoothly.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)