flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Till Rohrmann (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-3412) Remove implicit conversions JavaStream / ScalaStream
Date Tue, 16 Feb 2016 10:35:18 GMT

    [ https://issues.apache.org/jira/browse/FLINK-3412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15148421#comment-15148421

Till Rohrmann commented on FLINK-3412:

We could also do the conversion a bit more explicit by providing a {{Scala/JavaConverter}}
which has a {{asScala/asJava}} method which returns the respective {{DataStream}}. That's
also how the Scala API allows you to convert Scala collections from and to Java collections.

Something like

object JavaConverter {
	implicit class Java2ScalaConverter[T](dataStream: org.apache.flink.streaming.api.datastream.DataStream[T])
		def asScala: org.apache.flink.streaming.api.scala.DataStream[T] = {

> Remove implicit conversions JavaStream / ScalaStream
> ----------------------------------------------------
>                 Key: FLINK-3412
>                 URL: https://issues.apache.org/jira/browse/FLINK-3412
>             Project: Flink
>          Issue Type: Bug
>          Components: Scala API
>    Affects Versions: 0.10.2
>            Reporter: Stephan Ewen
>             Fix For: 1.0.0
> I think the implicit conversions between the Java DataStream and the Scala DataStream
are dangerous.
> Because conversions exist in both directions, it is possible to write methods that look
like calling functions on the JavaStream, but instead convert it to a Scala stream and call
a different method.
> I just accidentally implemented an infinite recursion that way (via two hidden implicit
> Making the conversions explicit (with a {{wrap()}} function like in the batch API, we
add minimally more code internally (nothing is different for users), but avoid such accidental

This message was sent by Atlassian JIRA

View raw message