Note that the translated JML pattern does not work
when the equality test is based on value equality be-
tween objects. This is the case when the type of
the field is String where the equality test should be
based on the method equals rather than ==. One
way to have another version of the JML pattern that
uses equals, so that the mapping chooses the right
pattern based on the type of the property.
5 CONCLUSIONS
We proposed an approach to translating OCL con-
straints to JML assertions based on the concept of
constraint pattern. The main component of our ap-
proach is a set of JML constraint patterns implement-
ing OCL constraint patterns. The possible benefits
of this approach is enhancing the quality of the trans-
lated assertions by expressing them in a more compact
way, and support automating the translation. With ap-
propriate tool support, the JML patterns can be used
stand alone to facilitate and simplify the development
of JML assertions. The pattern-based approach will
have to be evaluated with some real examples.
REFERENCES
Ackermann, J. and Turowski, K. (2006). A Library of OCL
Specification Patterns for Behavioral Specification of
Software Components. In Proceedings of the 18th in-
ternational conference on Advanced Information Sys-
tems Engineering, CAiSE’06, pages 255–269, Berlin,
Heidelberg. Springer-Verlag.
Avila, C., Flores, G., and Cheon, Y. (2008). A Library-
based Approach to Translating OCL Constraints to
JML Assertions for Runtime Checking. In Interna-
tional Conference on Software Engineering Research
and Practice, Las Vegas, Nevada, pages 403–408.
Cheon, Y. and Leavens, G. T. (2002). A Runtime Assertion
Checker for the Java Modeling Language (JML). In
Proceedings of the International Conference on Soft-
ware Engineering Research and Practice (SERP 02),
Las Vegas, pages 322–328. CSREA Press.
Cheon, Y., Leavens, G. T., Sitaraman, M., and Edwards,
S. (2005). Model Variables: Cleanly Supporting Ab-
straction in Design by Contract. Software-practice &
Experience, 35(6):583–599.
Cok, D. R. and Kiniry, J. R. (2004). ESC/Java2: Uniting
ESC/Java and JML - Progress and Issues in Building
and Using ESC/Java2. In Construction and Analysis
of Safe, Secure and Interoperable Smart Devices: In-
ternational Workshop, CASSIS 2004. SpringerVerlag.
Davis, J. P. and Bonnell, R. D. (2007). Propositional
Logic Constraint Patterns and Their Use in UML-
Based Conceptual Modeling and Analysis. IEEE
Trans. Knowl. Data Eng., pages 427–440.
Frankel, D. (2002). Model Driven Architecture: Applying
MDA to Enterprise Computing. John Wiley & Sons,
Inc., New York, NY, USA.
Hamie, A. (2004). Translating the Object Constraint Lan-
guage into the Java Modelling Language. In Proceed-
ings of the ACM Symposium on Applied Computing,
pages 1531–1535. ACM Press.
Jacobs, B. and Poll, E. (2003). Java Program Verification
at Nijmegen: Developments and Perspective. In Ni-
jmegen Institute of Computing and Information Sci-
ences, pages 134–153. Springer.
Leavens, G. T., Baker, A. L., and Ruby, C. (2006). Prelim-
inary Design of JML: A Behavioral Interface Specifi-
cation Language for Java. SIGSOFT, 31(3):1–38.
Leavens, G. T., Cheon, Y., Clifton, C., Ruby, C., and Cok,
D. R. (2003). How the design of JML accommo-
dates both runtime assertion checking and formal ver-
ification. In SCIENCE OF COMPUTER PROGRAM-
MING, pages 262–284.
OMG (2006). Unified Modeling Language Specification
2.0: Infrastructure. OMG doc. smsc/06-02-06.
Wahler, M., Koehler, J., and Brucker, A. D. (2006). Model-
Driven Constraint Engineering. In MoDELS Workshp.
on OCL for (Meta-)Models in Multiple Application
Domains, pages 111–125.
Warmer, J. and Kleppe, A. (2003). The Object Constraint
Language: Getting Your Models Ready for MDA.
Addison-Wesley, Reading, MA.
MODELSWARD2014-InternationalConferenceonModel-DrivenEngineeringandSoftwareDevelopment
200