LastExceed
04/04/2022, 11:28 AMval buffer = ByteBuffer.allocate(4450)
intellij says the inferred type of this is val buffer: (ByteBuffer..ByteBuffer?)
what does that mean? this isn't even valid code when i try to type this out myself. the code compiles fine on my machine, but jitpack.io fails because of a type mismatch. what is going on here?Michael de Kaste
04/04/2022, 11:38 AMval buffer = ByteBuffer.allocate(4450)!!
or
val buffer = ByteBuffer.allocate(4450) ?: return someFailedReturn
LastExceed
04/04/2022, 11:38 AMByteBuffer!
then ?ByteBuffer!
as expected. however jitpack still fails with Type mismatch: inferred type is Buffer! but ByteBuffer was expected
Sam
04/04/2022, 11:57 AMBuffer
? That sounds like something from a different library entirely. Is that a typo or is that the exact wording of the error message?LastExceed
04/04/2022, 12:00 PMSam
04/04/2022, 12:02 PMLastExceed
04/04/2022, 12:06 PMjava.nio.ByteBuffer
everywhereephemient
04/04/2022, 12:11 PMByteBuffer.clear()
is a method of its Buffer
supertype on Java 8- and so returns a Buffer
, while there is a specific overload on Java 9+ that returns a ByteBuffer
insteaddmitriy.novozhilov
04/04/2022, 12:13 PMT!
is a short form of (T..T?)
typeLastExceed
04/04/2022, 12:17 PMephemient
04/04/2022, 12:21 PMdmitriy.novozhilov
04/04/2022, 12:21 PMLastExceed
04/04/2022, 12:22 PMephemient
04/04/2022, 12:23 PM-Xjdk-release
coming in Kotlin 1.7, similar to Java's --release
flag, to make it a bit less painful to target older JDKs when building with a newer one'