コード例 #1
0
 /**
  * @return a String representation of the invariantToTest. This String is produced by invoking
  *     the invariant's format_using with method with the argument OutputFormat.Daikon.
  */
 private static String getInvariantFormat() {
   try {
     return (String) outputProducer.invoke(invariantToTest, new Object[] {OutputFormat.DAIKON});
   } catch (Exception e) {
     throw new RuntimeException(invariantToTest + " " + outputProducer);
   }
 }
コード例 #2
0
 /**
  * @return the InvariantStatus produced by invoking invariantToTest's check_modified method on
  *     the arguments represented by params.
  */
 private static InvariantStatus getCheckStatus(Object[] params) {
   try {
     return (InvariantStatus) checkModified.invoke(invariantToTest, params);
   } catch (Exception e) {
     throw new RuntimeException(" error in " + invariantToTest.getClass() + ": " + e);
   }
 }
コード例 #3
0
 /**
  * This function instantiates an invariant class by using the <type>(PptSlice) constructor.
  *
  * @param theClass the invariant class to be instantiated
  * @param sl the PptSlice representing the variables about which an invariant is determined
  * @return an instance of the class in theClass if one can be constructed, else throw a
  *     RuntimeException
  */
 private static Invariant instantiateClass(Class<? extends Invariant> theClass, PptSlice sl) {
   try {
     Method get_proto = theClass.getMethod("get_proto", new Class<?>[] {});
     Invariant proto = (/*@Prototype*/ Invariant) get_proto.invoke(null, new Object[] {});
     Invariant inv = proto.instantiate(sl);
     return (inv);
   } catch (Exception e) {
     e.printStackTrace(System.out);
     throw new RuntimeException(
         "Error while instantiating invariant " + theClass.getName() + ": " + e.toString());
   }
 }