[
https://issues.apache.org/jira/browse/BEAM-9326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17039576#comment-17039576
]
Kenneth Knowles commented on BEAM-9326:
---------------------------------------
It is important for {{MapElements}}. The data type {{PCollection<T>}} is
covariant in {{T}} so when {{S extends T}} the type {{PCollection<S>}} should
be considered a subtype of {{PCollection<T>}}. Java does not have the ability
to express this, so every use of the type has to use {{PCollection<? externds
T>}} for proper type checking, except in a contravariant position (aka as an
output) in which case it should be {{PCollection<? super T>}}.
So if you have {{MapElements.via}} of a function {{X -> Y}} you have to have
this type in order to apply it to a {{PCollection<A>}} where {{A extends X}}.
Really, many of these things are not usable without the {{? extends T}} pattern.
Does it cause a problem?
> JsonToRow transform should not use bounded Wildcards for its input
> ------------------------------------------------------------------
>
> Key: BEAM-9326
> URL: https://issues.apache.org/jira/browse/BEAM-9326
> Project: Beam
> Issue Type: Improvement
> Components: sdk-java-core
> Reporter: Ismaël Mejía
> Assignee: Ismaël Mejía
> Priority: Minor
> Fix For: 2.20.0
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The JsonToRow PTransform input is a String (a final class in Java) so no
> reason
> to define a bounded wildcard as its argument.
> We should use <? extends String> in Beam's codebase only when required by Java
> Generics constraints.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)