This doesn’t compile with Scala 2.7.7.final or 2.8.0.final for me:
new FileInputStream("test.txt") getChannel transferTo(
0, Long.MaxValue, new FileOutputStream("test-copy.txt") getChannel)
This does compile with Scala 2.7.7.final and 2.8.0.final for me:
new FileInputStream("test.txt") getChannel() transferTo(
0, Long.MaxValue, new FileOutputStream("test-copy.txt") getChannel)
Why is it that I need to do getChannel() instead of just getChannel here?
The reason is really simple. If you are using spaces instead of .’s to chain method calls then:
In your case the last two parameters are being called like (because
dis more than one parameter,d,eandfsay):i.e. the same as the first case. However, you want the call to be:
Which is not the same!
a = new FileInputStream("test.txt")b = getChannelc = transferTod = new FileOutputStream("test-copy.txt") getChannele = 0f = Long.MaxValueThis has not changed between 2.7 and 2.8 as far as I’m aware!