File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
dubbo-remoting/dubbo-remoting-api/src/test/java/org/apache/dubbo/remoting/buffer
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 1616 */
1717package org .apache .dubbo .remoting .buffer ;
1818
19+ import java .nio .Buffer ;
1920import java .nio .ByteBuffer ;
2021
2122import org .junit .jupiter .api .Assertions ;
@@ -75,7 +76,8 @@ void testWrappedBuffer() {
7576 channelBuffer = ChannelBuffers .wrappedBuffer (byteBuffer );
7677 Assertions .assertTrue (channelBuffer instanceof ByteBufferBackedChannelBuffer );
7778
78- byteBuffer .position (byteBuffer .limit ());
79+ // be compatible with jdk8 by casting byteBuffer's type to its parent class - `java.nio.Buffer`.
80+ ((Buffer ) byteBuffer ).position (byteBuffer .limit ());
7981 channelBuffer = ChannelBuffers .wrappedBuffer (byteBuffer );
8082 Assertions .assertEquals (channelBuffer , EMPTY_BUFFER );
8183 }
Original file line number Diff line number Diff line change 1919import org .apache .dubbo .common .utils .Assert ;
2020import org .apache .dubbo .common .utils .CollectionUtils ;
2121
22+ import java .nio .Buffer ;
2223import java .nio .ByteBuffer ;
2324import java .nio .charset .StandardCharsets ;
2425import java .util .ArrayList ;
@@ -67,7 +68,8 @@ public static int readRawVarint32(ByteBuffer byteBuffer) {
6768 val = val << 7 ;
6869 val = val | (byteBuffer .get (index ) & 0x7F );
6970 }
70- byteBuffer .position (currentPosition + varIntLength );
71+ // be compatible with jdk8 by casting byteBuffer's type to its parent class - `java.nio.Buffer`.
72+ ((Buffer ) byteBuffer ).position (currentPosition + varIntLength );
7173 return val ;
7274 }
7375
You can’t perform that action at this time.
0 commit comments