Skip to content

Commit

Permalink
fixed StringCharBuffer (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyasCs012 authored Sep 20, 2024
1 parent 0de04fa commit 8fe399b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/classes/modules/java.base/java/nio/ByteBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,9 @@ public ByteBuffer putLong(long x) {

return this;
}
public int arrayOffset(){
return offset;
}

@Override
public byte[] array() {
Expand Down Expand Up @@ -316,4 +319,9 @@ public boolean equals(Object ob) {
Object base() {
return array;
}
@Override
public final ByteBuffer flip() {
super.flip();
return this;
}
}
3 changes: 3 additions & 0 deletions src/classes/modules/java.base/java/nio/CharBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public static CharBuffer wrap(CharSequence outMess) {
charBuffer.flip();
return charBuffer;
}
public int arrayOffset(){
return offset;
}

@Override
public char[] array() {
Expand Down
16 changes: 16 additions & 0 deletions src/tests/CharBufferTest.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}
}

0 comments on commit 8fe399b

Please sign in to comment.