Closed He-Pin closed 1 year ago
We don't keep a ticket open if the bug doesn't exist in 2.13, but the ticket can have value regardless as a place to share workarounds.
Whether a 2.12 backport of the fix would be possible, I don't know — someone would need to do a bisect to figure out what PR fixed this.
Note that I'm unable to easily try this code myself since it's missing a lot of needed imports.
Interestingly, 2.13.0 still says
[error] found : (String, Throwable) => Unit
[error] required: java.util.function.BiFunction[_ >: String, Throwable, _]
[error] val h = g.handle((s, t) => println(s"Unit handling $s on error $t"))
[error] ^
[error] one error found
but compiles in 2.13.1.
Minimize is trivialize:
new CompletableFuture[String].handle((s, t) => println(s"Unit handling $s on error $t"))
Hope this get back ported to 2.12.x,with the SAM lamda support too.
We don't keep a ticket open if the bug doesn't exist in 2.13, but the ticket can have value regardless as a place to share workarounds.
Whether a 2.12 backport of the fix would be possible, I don't know — someone would need to do a bisect to figure out what PR fixed this.
The problem is when handling the java Interface with use side varient, and another issue is lack of sam lamda in 2.12.x.
@som-snytt and interesting is the whenComplete
compiles
@SethTisue sorry not minimize it as I was want to show which have a real usage
I'm looking at https://github.com/scala/bug/issues/11558 for a discrete backport. It is not obviously untenable.
Reproduction steps
Scala version: 2.12.17
Works in 2.13
https://github.com/akka/akka/pull/31918/files#diff-f9740bf92e4d83e90e297bde9ecbbb5a624b269455cc21a0c805fd7a0458785cR71-R72
Problem