Skip to content

Rectifies the java.lang.NoSuchMethodError when usinf printf #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/classes/java/util/regex/Matcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public Matcher reset(CharSequence inp) {
public native boolean matches();

public native boolean find();

public native boolean find(int start);

public native boolean lookingAt();

Expand Down
6 changes: 6 additions & 0 deletions src/peers/gov/nasa/jpf/vm/JPF_java_util_regex_Matcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ public boolean matches____Z (MJIEnv env, int objref) {
return matcher.matches();
}

@MJI
public boolean find__I__Z (MJIEnv env, int objref, int i) {
Matcher matcher = getInstance( env, objref);
return matcher.find(i);
}

@MJI
public boolean find____Z (MJIEnv env, int objref) {
Matcher matcher = getInstance( env, objref);
Expand Down
8 changes: 4 additions & 4 deletions src/tests/gov/nasa/jpf/test/java/io/PrintStreamTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@
*/
public class PrintStreamTest extends TestJPF {

@Test // currently fails with: java.lang.NoSuchMethodError: java.util.regex.Matcher.find(I)Z
@Test
public void testPrintCharFormat () {
if (verifyNoPropertyViolation()){
ByteArrayOutputStream baos = new ByteArrayOutputStream(1);
PrintStream baps = new PrintStream(baos, true);
// baps.printf("%c", 'a'); // fails
// assert (baos.toByteArray()[0] == 97);
baps.printf("%c", 'a');
assert (baos.toByteArray()[0] == 97);
}
}
}
}