Publication Date
2-2008
Abstract
OCL is a formal notation to specify constraints on UML models that cannot otherwise be expressed by diagrammatic notations such as class diagrams. Using OCL one can document detailed design decisions and choices along with the behavior, e.g., class invariants and method pre and postconditions. However, OCL constraints cannot be directly executed and checked at runtime by an implementation, thus constraint violations may not be detected or noticed, causing many potential development and maintenance problems. In this paper we propose an approach to checking OCL constraints at runtime by translating them to executable JML assertions. The key components of our approach are a set of JML library classes, use of model variables, and a separation of JML assertions from source code. The library classes implement OCL collection types and facilitate a direct mapping from OCL constraints to JML assertions by using model variables. The translated JML assertions are stored in specification files, separate from source code files, to ease change management of OCL constraints and Java source code. Our approach also facilitates a seamless transition from OCL-based designs to Java implementations.
Comments
Technical Report: UTEP-CS-08-05