scala> java.nio.ByteBuffer.allocate(1).isReadOnly
Scala 2 returns false as expected.
Dotty displays the following error message instead:
variable isReadOnly cannot be accessed as a member of java.nio.ByteBuffer from module class rs$line$1$
Same applies to CharBuffer, IntBuffer, LongBuffer, et al.
This can be worked around by upcasting ByteBuffer to Buffer:
(java.nio.ByteBuffer.allocate(1): java.nio.Buffer).isReadOnly
isReadOnly() is a public method in java.nio.Buffer, java.nio.ByteBuffer extends this class but also contains a non-public field called isReadOnly which is what Dotty ends up trying to call, even though it's a non-accessible overload.
Thanks
We should keep the issue open since there's still a bug on Dotty's side here :).
Most helpful comment
We should keep the issue open since there's still a bug on Dotty's side here :).