Closed
Description
Minimized code
The following code can be compiled using JDK 8. However, it will output ambiguous overload error when using JDK 11.
Environment:
Ubuntu
openjdk 1.8.0_275
openjdk 11.0.9.1
val decoderOut = java.nio.CharBuffer.allocate(1000)
val p = decoderOut.position
Output
-- [E051] Reference Error: Stest.scala:7:19 ------------------------------------
7 |val p = decoderOut.position
| ^^^^^^^^^^^^^^^^^^^
|Ambiguous overload. The overloaded alternatives of method position in class CharBuffer with types
| (x$0: Int): java.nio.CharBuffer
| (): Int
|both match expected type <?>
Expectation
The compiler shoud find and use position(): Int
here.