JPF svn revision: 1849
Java version: java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Server VM (build 14.2-b01, mixed mode)
JPF throws ArrayIndexOutOfBoundException for the following code, but it
should print the "false" value.
input:
import java.lang.reflect.*;
public class GetBoolean {
private static volatile boolean ff;
public static void main(String[] args) {
try {
GetBoolean test = new GetBoolean();
Field field = GetBoolean.class.getDeclaredFields()[0];
boolean a = field.getBoolean(test);
} catch (Exception ex) {
System.out.println(ex);
}
}
}
output:
[SEVERE] JPF exception, terminating: exception in native method java.lang.reflect.Field.getBoolean
java.lang.ArrayIndexOutOfBoundsException: 0
at gov.nasa.jpf.jvm.Fields.getIntValue(Fields.java:137)
at gov.nasa.jpf.jvm.ElementInfo.getIntField(ElementInfo.java:627)
at gov.nasa.jpf.jvm.JPF_java_lang_reflect_Field.getIntField(JPF_java_lang_reflect_Field.java:104)
at gov.nasa.jpf.jvm.JPF_java_lang_reflect_Field.getBoolean__Ljava_lang_Object_2__Z(JPF_java_lang_reflect_Field.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ....
java.lang.reflect.Field.getBoolean throws an exception with correct argument