00001 package gov.nasa.arc.ase.jpf.jvm.reflection; 00002 00003 import gov.nasa.arc.ase.jpf.InternalErrorException; 00004 import gov.nasa.arc.ase.jpf.jvm.Types; 00005 import gov.nasa.arc.ase.jpf.jvm.MethodInfo; 00006 import gov.nasa.arc.ase.jpf.jvm.bytecode.Instruction; 00007 00008 public class BanderaReflection extends Reflection { 00009 public Instruction executeStaticMethod(MethodInfo mi) { 00010 String name = mi.getFullName(); 00011 00012 if(name.equals("assert(Z)V")) { 00013 th.list.ks.ss.violatedAssertion |= !Types.intToBoolean(th.getLocalVariable(0)); 00014 00015 return exit(); 00016 } 00017 00018 if(name.equals("choose()Z")) { 00019 return exit(ss.random(2) != 0); 00020 } 00021 00022 return super.executeStaticMethod(mi); 00023 } 00024 public boolean isStaticMethodDeterministic(MethodInfo mi) { 00025 String name = mi.getFullName(); 00026 00027 if(name.equals("choose()Z")) { 00028 return false; 00029 } 00030 00031 return super.isStaticMethodDeterministic(mi); 00032 } 00033 }