Skip to content

Commit c347fb8

Browse files
committed
fixed StringCharBuffer
1 parent 0de04fa commit c347fb8

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/classes/modules/java.base/java/nio/ByteBuffer.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@ public ByteBuffer putLong(long x) {
263263

264264
return this;
265265
}
266+
public int arrayOffset(){
267+
return offset;
268+
}
266269

267270
@Override
268271
public byte[] array() {
@@ -316,4 +319,9 @@ public boolean equals(Object ob) {
316319
Object base() {
317320
return array;
318321
}
322+
@Override
323+
public final ByteBuffer flip() {
324+
super.flip();
325+
return this;
326+
}
319327
}

src/classes/modules/java.base/java/nio/CharBuffer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ public static CharBuffer wrap(CharSequence outMess) {
8888
charBuffer.flip();
8989
return charBuffer;
9090
}
91+
public int arrayOffset(){
92+
return offset;
93+
}
9194

9295
@Override
9396
public char[] array() {

src/tests/CharBufferTest.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import gov.nasa.jpf.util.test.TestJPF;
2+
import org.junit.Test;
3+
4+
import java.nio.CharBuffer;
5+
import java.nio.charset.CharacterCodingException;
6+
import java.nio.charset.CharsetEncoder;
7+
import java.nio.charset.StandardCharsets;
8+
9+
public class CharBufferTest extends TestJPF {
10+
@Test
11+
public void Test_Wrap() throws CharacterCodingException {
12+
if(verifyNoPropertyViolation()){
13+
java.nio.charset.StandardCharsets.UTF_8.newEncoder().encode(java.nio.CharBuffer.wrap("heyo"));
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)