jContractor is a purely library and design-pattern based approach to support Design By Contract specifications such as preconditions, postconditions, class invariants, and recovery and exception handling in Java. jContractor uses an intuitive naming convention, and standard Java syntax to instrument Java classes and enforce Design By Contract constructs. The designer of a class specifies a contract by defining protected methods which conform to the jContractor design patterns. jContractor uses Java Reflection to synthesize an instrumented version of a Java class containing jContractor contract specifications. The instrumented version contains code which enforces the Design By Contract specifications. Programmers enable the run-time enforcement of contracts by either incorporating the jContractor class loader or by instantiating objects directly from the instrumented subclass through the jContractor factory. Programmers can use exactly the same syntax for invoking methods and passing object references regardless of whether contracts are present or not. Since jContractor is purely library-based, it works with any Java implementation and requires no special tools such as modified compilers, modified JVMs, or pre-processors.
Cited By
- Lasseter J and Cipriano J Design pattern-based extension of class hierarchies to support runtime invariant checks Proceedings of the 16th international conference on Fundamental Approaches to Software Engineering, (163-178)
- Hirschfeld R, Perscheid M, Schubert C and Appeltauer M Dynamic contract layers Proceedings of the 2010 ACM Symposium on Applied Computing, (2169-2175)
- Dimoulas C, Pucella R and Felleisen M Future contracts Proceedings of the 11th ACM SIGPLAN conference on Principles and practice of declarative programming, (195-206)
- Smeets N and Steegmans E A methodology for writing class contracts Proceedings of the 31st international conference on Theory and Practice of Computer Science, (418-422)
- Kuliamin V, Petrenko A, Kossatchev A and Burdonov I (2019). The UniTesK Approach to Designing Test Suites, Programming and Computing Software, 29:6, (310-322), Online publication date: 1-Nov-2003.
- Barnett M and Schulte W (2003). Runtime verification of .NET contracts, Journal of Systems and Software, 65:3, (199-208), Online publication date: 15-Mar-2003.
- Ernst M, Cockrell J, Griswold W and Notkin D (2001). Dynamically Discovering Likely Program Invariants to Support Program Evolution, IEEE Transactions on Software Engineering, 27:2, (99-123), Online publication date: 1-Feb-2001.
- Krishnamurthy P and Sivilotti P The specification and testing of quantified progress properties in distributed systems Proceedings of the 23rd International Conference on Software Engineering, (201-210)
Recommendations
jContractor: Introducing Design-by-Contract to Java Using Reflective Bytecode Instrumentation
Design by Contract is a software engineering practice that allows semantic information to be added to a class or interface to precisely specify the conditions that are required for its correct operation. The basic constructs of Design by Contract are ...
jContractor: A Reflective Java Library to Support Design by Contract
Reflection '99: Proceedings of the Second International Conference on Meta-Level Architectures and ReflectionjContractor is a purely library based approach to support Design By Contract specifications such as preconditions, postconditions, class invariants, and recovery and exception handling in Java. jContractor uses an intuitive naming convention, and ...