From a89268ee45d135295705a504bd3a0b6536e99636 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Thu, 22 Feb 2018 08:52:34 +0100 Subject: [PATCH] ambiguous method byteBuffer.limit with jdk9 (#24593) ``` [error] /localhome/jenkinsakka/workspace/akka-nightly-jdk9/akka-remote/src/main/scala/akka/remote/artery/tcp/ArteryTcpTransport.scala:160:35: ambiguous reference to overloaded definition, [error] both method limit in class ByteBuffer of type (x$1: Int)java.nio.ByteBuffer [error] and method limit in class Buffer of type ()Int [error] match expected type ? [error] val size = env.byteBuffer.limit ``` --- .../scala/akka/remote/artery/tcp/ArteryTcpTransport.scala | 6 +++--- .../test/scala/akka/remote/artery/tcp/TcpFramingSpec.scala | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/akka-remote/src/main/scala/akka/remote/artery/tcp/ArteryTcpTransport.scala b/akka-remote/src/main/scala/akka/remote/artery/tcp/ArteryTcpTransport.scala index 266d4359f4..f37e532571 100644 --- a/akka-remote/src/main/scala/akka/remote/artery/tcp/ArteryTcpTransport.scala +++ b/akka-remote/src/main/scala/akka/remote/artery/tcp/ArteryTcpTransport.scala @@ -171,10 +171,10 @@ private[remote] class ArteryTcpTransport(_system: ExtendedActorSystem, _provider Flow[EnvelopeBuffer] .map { env ⇒ - // TODO Possible performance improvement, could we reduce the copying of bytes? - afr.hiFreq(TcpOutbound_Sent, env.byteBuffer.limit) - val size = env.byteBuffer.limit + val size = env.byteBuffer.limit() + afr.hiFreq(TcpOutbound_Sent, size) + // TODO Possible performance improvement, could we reduce the copying of bytes? val bytes = ByteString(env.byteBuffer) bufferPool.release(env) diff --git a/akka-remote/src/test/scala/akka/remote/artery/tcp/TcpFramingSpec.scala b/akka-remote/src/test/scala/akka/remote/artery/tcp/TcpFramingSpec.scala index 5b63d7ea32..0b1361a309 100644 --- a/akka-remote/src/test/scala/akka/remote/artery/tcp/TcpFramingSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/artery/tcp/TcpFramingSpec.scala @@ -87,8 +87,8 @@ class TcpFramingSpec extends AkkaSpec with ImplicitSender { val frames = Source.fromIterator(() ⇒ rechunk(bytes)).via(framingFlow).runWith(Sink.seq).futureValue frames.size should ===(numberOfFrames) frames.foreach { frame ⇒ - frame.byteBuffer.limit should ===(payload5.size) - val payload = new Array[Byte](frame.byteBuffer.limit) + frame.byteBuffer.limit() should ===(payload5.size) + val payload = new Array[Byte](frame.byteBuffer.limit()) frame.byteBuffer.get(payload) ByteString(payload) should ===(payload5) frame.streamId should ===(3)