Report ID
1998-31
Report Authors
Murat Karaorman, Urs Holzle, and John Bruno
Report Date
Abstract
jContractor is a purely library and design-pattern based approach to supportDesign By Contract specifications such as preconditions, postconditions, classinvariants, and recovery and exception handling in Java. jContractor uses anintuitive naming convention, and standard Java syntax to instrument Javaclasses and enforce Design By Contract constructs.The designer of a class specifies a contract by defining protected methodswhich conform to the jContractor design patterns. jContractor uses JavaReflection to synthesize an instrumented version of a Java class containingjContractor contract specifications. The instrumented version contains codewhich enforces the Design By Contract specifications. Programmers enable therun-time enforcement of contracts by either incorporating the jContractor classloader or by instantiatingï½ objects directly from the instrumentedsubclass through the jContractorï½ factory. Programmers can use exactlythe same syntax for invoking methods and passing object references regardlessof whether contracts are present or not. Since jContractor is purelylibrary-based, it works with any Java implementation and requires no specialtools such as modified compilers, modified JVMs, or pre-processors.
Document
1998-31.ps558.79 KB