JTurret, principally, is designed as a verifier and hence it is more appropriately tagged as a Watchdog.
Consider the case of a regular LIFO stack. In the usual case, the stack is defined by a specific size. For a better understanding of bounded stacks, refer Paul Black's primer. The computer software should never insert an element onto the top of the stack if the number of elements in the stack already equals its size. A failure to adhere to this crucial precondition, can be extremely dangerous.
Although this example is considerably simple, it still identifies an approach to the specification of behavioural characteristics. Meyer, thus identifies three important meta obligations that can be used to define contracts:
Each of the above, individually present a few issues in how implementation can be and has been carried out. I have made an effort to address all issues in my paper (here (pdf)).
If the idea interests you more, please consider:
JTurret allows contracts to be specified using linear temporal operators. Linear temporal operators are logical operators that model time, in a sense. What is interesting is it allows to consider Preconditions and Postcondtions as states that "must" be reached from the current state. Or rather, we can move from State 1 to State 2 only if the conditions, as specified, are satisfied (Precondition). We can then stress that we could move from State 2 to State 3 (if state 2 is assumed to be the invoked module), only if a subsequent condition is satisfied (PostCondition).
Downloading JTurret also includes many examples on how contracts should be specified, the API docs, and almost all the necessary tools.
I evaluate Precondtions (Past Linear temporal logic) by a recursive technique I had studied from a Security thesis ( Refer to the bib).
I evaluate Postconditions (Future Linear temporal Logic) by first converting the same to a generalized Buechi Automata and evaluating this at run time. While this might not be the best technique, it certainly helps to work with a the issues that arise with temporal operators.
I also discuss, and have implemented, a few alternatives. But they are more to serve as references as opposed to be them being actually used.
The JTurret places itself in the JVM and as the client software or Programs run, the execution is constantly monitored. If for instance, com.foo.FooClass is loaded into the memory, and com.foo.FooClass is also specified in the contract to meet with some post conditions, JTurret guarentees this is satisfied. Failure to do so, raises an exception. The exception can either be logged, or made to quit (the safer option).
Paper
The supporting paper can either be downloaded from the Downloads section or the latest version can be got from my website.
Fig 2. JVMTI running condition verification.
Fig 3. Precondition evaluation.