-
Notifications
You must be signed in to change notification settings - Fork 21
Type inference involving wildcards and SAMs #9756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9756?orig=1 |
@SethTisue said: One workaround is to explicitly annotate the return type in the call to scala> 1.to(10).asJava.stream().map[Int](_ + 1).collect(Collectors.toList[Int])
res3: java.util.List[Int] = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
scala> Seq("foo").asJava.stream().map[String](_.reverse)
res4: java.util.stream.Stream[String] = java.util.stream.ReferencePipeline$3@69d2c460 But note that A more generally applicable workaround here is to use scala-java8-compat (https://github.com/scala/scala-java8-compat), which exists exactly to improve interop in situations like this: scala> import scala.compat.java8.StreamConverters._
scala> 1.to(10).seqStream.map(_ + 1).toScala[Vector]
res0: Vector[Int] = Vector(2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
scala> import java.util.stream.Collectors
scala> 1.to(10).seqStream.map(_ + 1).boxed.collect(Collectors.toList())
res1: java.util.List[Integer] = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11] and so on. |
@szeiger said: scala> 1.to(10).asJava.stream().map(_ + 1)
res7: java.util.stream.Stream[?0] = java.util.stream.ReferencePipeline$3@2c991465
scala> 1.to(10).asJava.stream().map[Int](_ + 1)
res8: java.util.stream.Stream[Int] = java.util.stream.ReferencePipeline$3@f171912 Here's the signature of Stream.map: <R> Stream<R> map(Function<? super T,? extends R> mapper) It looks like the existential type from the call-site variance on R leaks out into the return type instead of being replaced by the inferred type R = Int. |
@adriaanm said: |
…ager listener callback (#464) * KC-1184: Consume metadata log and queue for BrokerMetadataListener * Cleanup test * Addressing comments * Controller: Fix BrokerRegistration + BrokerHeartbeat RPC * Workaround for Scala 2.12 SAM type-inference bug scala/bug#9756 * Address comments + fix BrokerLifecycleManagerTest failure * ControllerApis: Fix BrokerRegistrationResponse lease duration * KC-1270: Make use of the MetaLogListener callback that supplies us with new leader info - Integrate w/ the BrokerMetadataListener/MetadataCache for the broker to be notified through RAFT - Remove active controller ID from the heartbeat response * WIP: KC-1270 * Revert "WIP: KC-1270" This reverts commit 82fff44. * KC-1270 * Fix post-merge compilation error w/ Scala 2.12 * KC-1270: Fix BrokerMetadataListenerTest * Fix Broker Controller discovery w/ LocalLogManager - Configure broker/controller to use a common `metadata.log.dir` - Fix metadata checkpoints discovery to include the `metadata.log.dir` - Minor fix in `BrokerToControllerChannelManager` to use the correct controller for ManualMetadataUpdate in the NetworkClient * KC-1270: Add a test * Address review comments: Race condition in updating controller ID and PartitionMetadata
When call Have to insert the stage.handle[Unit]((value, ex) => {
if (ex != null) {
callback(scala.util.Failure[T](ex))
} else {
callback(scala.util.Success(value))
}
}) |
The text was updated successfully, but these errors were encountered: