java.lang.Object
edu.ucsb.ccs.jcontractor.jContractor
- public class jContractor
- extends java.lang.Object
Main entry point into the jContractor system. This class can be
run stand alone to run another program with contract checking
enabled. jContractor will substitute its own class loader for the
default class loader, and modify the bytecode of loaded classes to
enforce contracts at runtime. The runInstrumented(String,
String []) method may be used to programatically run a class with
contracts enabled.
If specified, the instrumentation file controls the instrumentation
level of each class in the system. The available instrumentation
levels are:
None - No contracts checked.
Pre - Preconditions checked.
Post - Preconditions and postconditions checked.
All - Preconditions, postconditions, and invariants checked.
The instrumentation file contains class names followed by
instrumentation levels, and separated by whitespace. For example:
* none
edu.* pre
edu.ucsb.ccs.jcontractor.jInstrument all
This file says the the jInstrument class should be instrumented
completetly and the other classes in edu and all subpackages should
have precondition checks. Wildcard matching works as in Java
import statements, except that the wildcard matches any class in
the package or any subpackage. More specific filters override
general filters (edu.ccs.jcontractor.jInstrument overrides edu.*).
If you would prefer to instrument a class and save the instrumented
bytecode so that it may be run without jContractor, take a look at
the jInstrument class.
Usage: jContractor [-options] class [args]
Options:
-f Specify the instrumentation file.
-v, --verbose Enable verbose logging. Prints name of each
class as it is instrumented.
-e, --version Print version number and exit.
Field Summary |
static java.lang.String |
USAGE_MESSAGE
Usage message to be printed if the command line arguments do not
match the specification. |
static java.lang.String |
VERSION
Constant for the version number that is printed when the
--version command line argument is given. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
USAGE_MESSAGE
public static final java.lang.String USAGE_MESSAGE
- Usage message to be printed if the command line arguments do not
match the specification.
- See Also:
- Constant Field Values
VERSION
public static final java.lang.String VERSION
- Constant for the version number that is printed when the
--version command line argument is given.
- See Also:
- Constant Field Values
jContractor
public jContractor()
runInstrumented
public static void runInstrumented(java.lang.String classname,
java.lang.String[] args)
throws java.lang.Throwable
- Run a class with contracts enabled. This method will replace the
default class loader with a jContractorClassLoader, and run the
code. This method uses a default instance of jInstrument, and
checks all contracts on all classes.
runInstrumented
public static void runInstrumented(java.lang.String classname,
java.lang.String[] args,
jInstrument instrumentor)
throws java.lang.Throwable
- Run a class with contracts enabled, using the specified instance
of jInstrument. This method will replace the default class
loader with a jContractorClassLoader, and run the code.
implies
public static boolean implies(boolean op1,
boolean op2)
- Deprecated. Use edu.ucsb.ccs.jaqual.Logical.implies instead.
main
public static void main(java.lang.String[] args)
- Main entry point to the application. This program requires one
command line argument, the name of a class to run. jContractor
will replace the default class loader with a
jContractorClassLoader, and run the program.