diff --git a/src/classes/modules/java.base/java/nio/ByteBuffer.java b/src/classes/modules/java.base/java/nio/ByteBuffer.java index f4621fa0..ad3bdfae 100644 --- a/src/classes/modules/java.base/java/nio/ByteBuffer.java +++ b/src/classes/modules/java.base/java/nio/ByteBuffer.java @@ -263,6 +263,9 @@ public ByteBuffer putLong(long x) { return this; } + public int arrayOffset(){ + return offset; + } @Override public byte[] array() { @@ -316,4 +319,9 @@ public boolean equals(Object ob) { Object base() { return array; } + @Override + public final ByteBuffer flip() { + super.flip(); + return this; + } } diff --git a/src/classes/modules/java.base/java/nio/CharBuffer.java b/src/classes/modules/java.base/java/nio/CharBuffer.java index b5714ac2..0bbafacc 100644 --- a/src/classes/modules/java.base/java/nio/CharBuffer.java +++ b/src/classes/modules/java.base/java/nio/CharBuffer.java @@ -88,6 +88,9 @@ public static CharBuffer wrap(CharSequence outMess) { charBuffer.flip(); return charBuffer; } + public int arrayOffset(){ + return offset; + } @Override public char[] array() { diff --git a/src/tests/CharBufferTest.java b/src/tests/CharBufferTest.java new file mode 100644 index 00000000..0502442b --- /dev/null +++ b/src/tests/CharBufferTest.java @@ -0,0 +1,16 @@ +import gov.nasa.jpf.util.test.TestJPF; +import org.junit.Test; + +import java.nio.CharBuffer; +import java.nio.charset.CharacterCodingException; +import java.nio.charset.CharsetEncoder; +import java.nio.charset.StandardCharsets; + +public class CharBufferTest extends TestJPF { + @Test + public void Test_Wrap() throws CharacterCodingException { + if(verifyNoPropertyViolation()){ + java.nio.charset.StandardCharsets.UTF_8.newEncoder().encode(java.nio.CharBuffer.wrap("heyo")); + } + } +}