skip to main content
article

Preliminary design of JML: a behavioral interface specification language for java

Published:01 May 2006Publication History
Skip Abstract Section

Abstract

JML is a behavioral interface specification language tailored to Java(TM). Besides pre- and postconditions, it also allows assertions to be intermixed with Java code; these aid verification and debugging. JML is designed to be used by working software engineers; to do this it follows Eiffel in using Java expressions in assertions. JML combines this idea from Eiffel with the model-based approach to specifications, typified by VDM and Larch, which results in greater expressiveness. Other expressiveness advantages over Eiffel include quantifiers, specification-only variables, and frame conditions.This paper discusses the goals of JML, the overall approach, and describes the basic features of the language through examples. It is intended for readers who have some familiarity with both Java and behavioral specification using pre- and postconditions.

References

  1. {AGH00} Ken Arnold, James Gosling, and David Holmes. The Java Programming Language Third Edition. Addison-Wesley, Reading, MA, 2000.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. {Ame87} Pierre America. Inheritance and subtyping in a parallel object-oriented language. In Jean Bezivin et al., editors, ECOOP '87, European Conference on Object-Oriented Programming, Paris, France, pages 234--242, New York, NY, June 1987. Springer-Verlag. Lecture Notes in Computer Science, volume 276.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. {Ame91} Pierre America. Designing an object-oriented programming language with behavioural subtyping. In J. W. de Bakker, W. P. de Roever, and G. Rozenberg, editors, Foundations of Object-Oriented Languages, REX School/Workshop, Noordwijkerhout, The Netherlands, May/June 1990, volume 489 of Lecture Notes in Computer Science, pages 60--90. Springer-Verlag, New York, NY, 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. {Bac88} R. J. R. Back. A calculus of refinements for program derivations. Acta Informatica, 25(6):593--624, August 1988.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. {BG98} Kent Beck and Erich Gamma. Test infected: Programmers love writing tests. Java Report, 3(7):37--50, 1998.]]Google ScholarGoogle Scholar
  6. {BMR95} Alex Borgida, John Mylopoulos, and Raymond Reiter. On the frame problem in procedure specifications. IEEE Transactions on Software Engineering, 21(10): 785--798, October 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. {BMvW98} Ralph Back, Anna Mikhajlova, and Joakim von Wright. Modeling component environments and interactive programs using iterative choice. Technical Report 200, Turku Centre for Computer Science, September 1998. http://www.tucs.abo.fi/publications/techreports/TR200.html.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. {BvW98} Ralph-Johan Back and Joakim von Wright. Refinement Calculus: A Systematic Introduction. Graduate Texts in Computer Science. Springer-Verlag, 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. {BW00} Martin Büchi and Wolfgang Weck. Generic wrappers. In Elisa Bertino, editor, ECOOP 2000 --- Object-Oriented Programming 14th European Conference, volume 1850 of Lecture Notes in Computer Science, pages 201--225, 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. {Cha02} Patrice Chalin. Back to basics: Language support and semantics of basic infinite integer types in JML and Larch. Technical Report CU-CS 2002-003.1, Computer Science Department, Concordia University, October 2002.]]Google ScholarGoogle Scholar
  11. {Cha04} Patrice Chalin. JML support for primitive arbitrary precision numeric types: Definition and semantics. Journal of Object Technology, 3(6):57--79, June 2004.]]Google ScholarGoogle ScholarCross RefCross Ref
  12. {Che03} Yoonsik Cheon. A runtime assertion checker for the Java Modeling Language. Technical Report 03-09, Department of Computer Science, Iowa State University, Ames, IA, April 2003. The author's Ph.D. dissertation.]]Google ScholarGoogle ScholarCross RefCross Ref
  13. {CL02a} Yoonsik Cheon and Gary T. Leavens. A run-time assertion checker for the Java Modeling Language (JML). In Hamid R. Arabnia and Youngsong Mun, editors, Proceedings of the International Conference on Software Engineering Research and Practice (SERP '02), Las Vegas, Nevada, USA, June 24-27, 2002, pages 322--328. CSREA Press, June 2002.]]Google ScholarGoogle Scholar
  14. {CL02b} Yoonsik Cheon and Gary T. Leavens. A simple and practical approach to unit testing: The JML and JUnit way. In Boris Magnusson, editor, ECOOP 2002 --- Object-Oriented Programming, 16th European Conference, Máalaga, Spain, Proceedings, volume 2374 of Lecture Notes in Computer Science, pages 231--255, Berlin, June 2002. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. {CL05} Yoonsik Cheon and Gary T. Leavens. A contextual interpretation of undefinedness for runtime assertion checking. In AADEBUG 2005, Proceedings of the Sixth International Symposium on Automated and Analysis-Driven Debugging, Monterey, California, September 19--21, 2005, pages 149--157. ACM Press, September 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. {Coh90} Edward Cohen. Programming in the 1990s: An Introduction to the Calculation of Programs. Springer-Verlag, New York, NY, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. {DL96} Krishna Kishore Dhara and Gary T. Leavens. Forcing behavioral subtyping through specification inheritance. In Proceedings of the 18th International Conference on Software Engineering, Berlin, Germany, pages 258--267. IEEE Computer Society Press, March 1996. A corrected version is Iowa State University, Dept. of Computer Science TR #95-20c.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. {ECGN01} Michael Ernst, Jake Cockrell, William G. Gris-wold, and David Notkin. Dynamically discovering likely program invariants to support program evolution. IEEE Transactions on Software Engineering, 27(2):99--123, February 2001.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. {Fin96} Kate Finney. Mathematical notation in formal specification: Too difficult for the masses? IEEE Transactions on Software Engineering, 22(2):158--159, February 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. {FL98} John Fitzgerald and Peter Gorm Larsen. Modelling Systems: Practical Tools in Software Development. Cambridge, Cambridge, UK, 1998.]]Google ScholarGoogle Scholar
  21. {GHG+93} John V. Guttag, James J. Horning, S. J. Garland, K. D. Jones, A. Modet, and J. M. Wing. Larch: Languages and Tools for Formal Specification. Springer-Verlag, New York, NY, 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. {GJSB00} James Gosling, Bill Joy, Guy Steele, and Gilad Bracha. The Java Language Specification Second Edition. The Java Series. Addison-Wesley, Boston, Mass., 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. {GL86} David K. Gifford and John M. Lucassen. Integrating functional and imperative programming. In ACM Conference on LISP and Functional Programming, pages 28--38. ACM, August 1986.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. {GS95} David Gries and Fred B. Schneider. Avoiding the undefined by underspecification. In Jan van Leeuwen, editor, Computer Science Today: Recent Trends and Developments, number 1000 in Lecture Notes in Computer Science, pages 366--373. Springer-Verlag, New York, NY, 1995.]]Google ScholarGoogle Scholar
  25. {Hay93} I. Hayes, editor. Specification Case Studies. International Series in Computer Science. Prentice-Hall, Inc., second edition, 1993.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. {Hoa69} C. A. R. Hoare. An axiomatic basis for computer programming. Communications of the ACM, 12(10):576--583, October 1969.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. {Hoa72} C. A. R. Hoare. Proof of correctness of data representations. Acta Informatica, 1(4):271--281, 1972.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. {Hui01} Marieke Huisman. Reasoning about Java Programs in higher order logic with PVS and Isabelle. Ipa dissertation series, 2001-03, University of Nijmegen, Holland, February 2001.]]Google ScholarGoogle Scholar
  29. {Jon90} Cliff B. Jones. Systematic Software Development Using VDM. International Series in Computer Science. Prentice Hall, Englewood Cliffs, N.J., second edition, 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. {Jon91} H. B. M. Jonkers. Upgrading the pre- and postcondition technique. In S. Prehn and W. J. Toetenel, editors, VDM '91 Formal Software Development Methods 4th International Symposium of VDM Europe Noordwijkerhout, The Netherlands, Volume 1: Conference Contributions, volume 551 of Lecture Notes in Computer Science, pages 428--456. Springer-Verlag, New York, NY, October 1991.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. {JvdBH+98} Bart Jacobs, Joachim van den Berg, Marieke Huisman, Martijn van Berkum, Ulrich Hensel, and Hendrik Tews. Reasoning about Java classes (preliminary report). In OOPSLA '98 Conference Proceedings, volume 33(10) of ACM SIGPLAN Notices, pages 329--340. ACM, October 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. {LB99} Gary T. Leavens and Albert L. Baker. Enhancing the pre- and postcondition technique for more expressive specifications. In Jeannette M. Wing, Jim Woodcock, and Jim Davies, editors, FM'99 --- Formal Methods: World Congress on Formal Methods in the Development of Computing Systems, Toulouse, France, September 1999, Proceedings, volume 1709 of Lecture Notes in Computer Science, pages 1087--1106. Springer-Verlag, 1999.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. {LBR99} Gary T. Leavens, Albert L. Baker, and Clyde Ruby. JML: A notation for detailed design. In Haim Kilov, Bernhard Rumpe, and Ian Simmonds, editors, Behavioral Specifications of Businesses and Systems, pages 175--188. Kluwer Academic Publishers, Boston, 1999.]]Google ScholarGoogle ScholarCross RefCross Ref
  34. {Lea96} Gary T. Leavens. An overview of Larch/C++: Behavioral specifications for C++ modules. In Haim Kilov and William Harvey, editors, Specification of Behavioral Semantics in Object-Oriented Information Modeling, chapter 8, pages 121--142. Kluwer Academic Publishers, Boston, 1996. An extended version is TR #96-01d, Department of Computer Science, Iowa State University, Ames, Iowa, 50011.]]Google ScholarGoogle Scholar
  35. {Lea97} Gary T. Leavens. Larch/C++ Reference Manual. Version 5.14. Available in ftp://ftp.cs.iastate.edu/pub/larchc+ +/lcpp.ps.gz or on the World Wide Web at the URL http://www.cs.iastate.edu/~leavens/larchc++.html, October 1997.]]Google ScholarGoogle Scholar
  36. {Lea00} Gary T. Leavens. Larch frequently asked questions. Version 1.110. Available in http://www.cs.iastate.edu/~leavens/larch-faq.html, May 2000.]]Google ScholarGoogle Scholar
  37. {Lei95a} K. Rustan M. Leino. A myth in the modular specification of programs. Technical Report KRML 63, Digital Equipment Corporation, Systems Research Center, 130 Lytton Avenue Palo Alto, CA 94301, November 1995. Obtain from the author, at [email protected].]]Google ScholarGoogle Scholar
  38. {Lei95b} K. Rustan M. Leino. Toward Reliable Modular Programs. PhD thesis, California Institute of Technology, 1995. Available as Technical Report Caltech-CS-TR-95-03.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. {Lei98} K. Rustan M. Leino. Data groups: Specifying the modification of extended state. In OOPSLA '98 Conference Proceedings, volume 33(10) of ACM SIGPLAN Notices, pages 144--153. ACM, October 1998.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. {LG88} John M. Lucassen and David K. Gifford. Polymorphic effect systems. In Conference Record of the Fifteenth Annual ACM Symposium on Principles of Programming Languages, San Diego, Calif., pages 47--57. ACM, January 1988.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. {LH94} K. Lano and H. Haughton, editors. Object-Oriented Specification Case Studies. The Object-Oriented Series. Prentice Hall, New York, NY, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. {LNS00} K. Rustan M. Leino, Greg Nelson, and James B. Saxe. ESC/Java user's manual. Technical note, Compaq Systems Research Center, October 2000.]]Google ScholarGoogle Scholar
  43. {LPC+05} Gary T. Leavens, Erik Poll, Curtis Clifton, Yoonsik Cheon, Clyde Ruby, David R. Cok, Peter Müller, and Joseph Kiniry. JML reference manual. Department of Computer Science, Iowa State University. Available from http://www.jmlspecs.org, July 2005.]]Google ScholarGoogle Scholar
  44. {LPHZ02} K. Rustan M. Leino, Arnd Poetzsch-Heffter, and Yunhong Zhou. Using data groups to specify and check side effects. In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation (PLDI'02), volume 37, 5 of SIGPLAN, pages 246--257, New York, June 17--19 2002. ACM Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. {Luc87} John M. Lucassen. Types and effects: Towards the integration of functional and imperative programming. Technical Report TR-408, Massachusetts Institute of Technology, Laboratory for Computer Science, August 1987.]]Google ScholarGoogle Scholar
  46. {LvH85} David Luckham and Friedrich W. von Henke. An overview of anna - a specification language for Ada. IEEE Software, 2(2):9--23, March 1985.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  47. {LvHKBO87} David Luckham, Friedrich W. von Henke, Bernd Krieg-Brückner, and Olaf Owe. ANNA - A Language for Annotating Ada Programs, volume 260 of Lecture Notes in Computer Science. Springer-Verlag, New York, NY, 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. {LW94} Barbara Liskov and Jeannette Wing. A behavioral notion of subtyping. ACM Transactions on Programming Languages and Systems, 16(6):1811--1841, November 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. {LW95} Gary T. Leavens and William E. Weihl. Specification and verification of object-oriented programs using supertype abstraction. Acta Informatica, 32(8):705--778, November 1995.]]Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. {LW97} Gary T. Leavens and Jeannette M. Wing. Protective interface specifications. In Michel Bidoit and Max Dauchet, editors, TAPSOFT '97: Theory and Practice of Software Development, 7th International Joint Conference CAAP/FASE, Lille, France, volume 1214 of Lecture Notes in Computer Science, pages 520--534. Springer-Verlag, New York, NY, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. {Mey92a} Bertrand Meyer. Applying "design by contract". Computer, 25(10): 40--51, October 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. {Mey92b} Bertrand Meyer. Eiffel: The Language. Object-Oriented Series. Prentice Hall, New York, NY, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. {Mey97} Bertrand Meyer. Object-oriented Software Construction. Prentice Hall, New York, NY, second edition, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. {Mor94} Carroll Morgan. Programming from Specifications: Second Edition. Prentice Hall International, Hempstead, UK, 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. {Mül02} Peter Müller. Modular Specification and Verification of Object-Oriented Programs, volume 2262 of Lecture Notes in Computer Science. Springer-Verlag, 2002. The author's Ph.D. Thesis. Available from http://www.informatik.fernuni-hagen. de/import/pi5/publications.html.]]Google ScholarGoogle Scholar
  56. {MV94} Carroll Morgan and Trevor Vickers, editors. On the refinement calculus. Formal approaches of computing and information technology series. Springer-Verlag, New York, NY, 1994.]]Google ScholarGoogle Scholar
  57. {NNA97} H. R. Nielson, F. Nielson, and T. Amtoft. Polymorphic subtyping for effect analysis: The static semantics. In M. Dam, editor, Proceedings of the Fifth LOMAPS Workshop, number 1192 in Lecture Notes in Computer Science. Springer-Verlag, 1997.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. {Org96} International Standards Organization. Information technology -- programming languages, their environments and system software interfaces -- Vienna Development Method -- specification language -- part 1: Base language. ISO/IEC 13817-1, December 1996.]]Google ScholarGoogle Scholar
  59. {ORSvH95} Sam Owre, John Rushby, Natarajan Shankar, and Friedrich von Henke. Formal verification for fault-tolerant architectures: Prolegomena to the design of PVS. IEEE Transactions on Software Engineering, 21(2):107--125, February 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. {OSWZ94} William F. Ogden, Murali Sitaraman, Bruce W. Weide, and Stuart H. Zweben. Part I: The RESOLVE framework and discipline --- a research synopsis. ACM SIGSOFT Software Engineering Notes, 19(4): 23--28, October 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. {PH97} Arnd Poetzsch-Heffter. Specification and verification of object-oriented programs. Habilitation thesis, Technical University of Munich, January 1997.]]Google ScholarGoogle Scholar
  62. {RDF+05} Edwin Rodríguez, Matthew B. Dwyer, Cormac Flanagan, John Hatcliff, Gary T. Leavens, and Robby. Extending JML for modular specification and verification of multi-threaded programs. In Andrew P. Black, editor, ECOOP 2005 --- Object-Oriented Programming 19th European Conference, Glasgow, UK, volume 3586 of Lecture Notes in Computer Science, pages 551--576. Springer-Verlag, Berlin, July 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. {RL00} Clyde Ruby and Gary T. Leavens. Safely creating correct subclasses without seeing superclass code. In OOPSLA 2000 Conference on Object-Oriented Programming, Systems, Languages, and Applications, Minneapolis, Minnesota, volume 35(10) of ACM SIGPLAN Notices, pages 208--228, October 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. {RL05} Arun D. Raghavan and Gary T. Leavens. Desugaring JML method specifications. Technical Report 00-03e, Iowa State University, Department of Computer Science, May 2005.]]Google ScholarGoogle Scholar
  65. {Ros95} David S. Rosenblum. A practical approach to programming with assertions. IEEE Transactions on Software Engineering, 21(1): 19--31, January 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  66. {Spi92} J. Michael Spivey. The Z Notation: A Reference Manual. International Series in Computer Science. Prentice-Hall, New York, NY, second edition, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  67. {SR05} Alexandru Salcianu and Martin Rinard. Purity and side effect analysis for java programs. In Proceedings of the 6th International Conference on Verification, Model Checking and Abstract Interpretation, January 2005.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  68. {Tan94} Yang Meng Tan. Interface language for supporting programming styles. ACM SIGPLAN Notices, 29(8):74--83, August 1994. Proceedings of the Workshop on Interface Definition Languages.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  69. {Tan95} Yang Meng Tan. Formal Specification Techniques for Engineering Modular C Programs, volume 1 of Kluwer International Series in Software Engineering. Kluwer Academic Publishers, Boston, 1995.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  70. {TJ94} Jean-Pierre Talpin and Pierre Jouvelot. The type and effect discipline. Information and Computation, 111(2):245--296, June 1994.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  71. {WD96} Jim Woodcock and Jim Davies. Using Z: Specification, Refinement, and Proof. Prentice Hall International Series in Computer Science, 1996.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  72. {Wil94} Alan Wills. Refinement in Fresco. In Lano and Houghton {LH94}, chapter 9, pages 184--201.]]Google ScholarGoogle Scholar
  73. {Win83} Jeannette Marie Wing. A two-tiered approach to specifying programs. Technical Report TR-299, Massachusetts Institute of Technology, Laboratory for Computer Science, 1983.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  74. {Win87} Jeannette M. Wing. Writing Larch interface language specifications. ACM Transactions on Programming Languages and Systems, 9(1): 1--24, January 1987.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  75. {Win90} Jeannette M. Wing. A specifier's introduction to formal methods. Computer, 23(9):8--24, September 1990.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  76. {WLB00} Tim Wahls, Gary T. Leavens, and Albert L. Baker. Executing formal specifications with concurrent constraint programming. Automated Software Engineering, 7(4):315--343, December 2000.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  77. {WR25} A. N. Whitehead and B. Russell. Principia Mathematica. Cambridge University Press, London, second edition. edition, 1925.]]Google ScholarGoogle Scholar
  78. {Wri92} Andrew K. Wright. Typing references by effect inference. In Bernd Krieg-Bruckner, editor, ESOP '92, 4th European Symposium on Programming, Rennes, France, February 1992, Proceedings, volume 582 of Lecture Notes in Computer Science, pages 473--491. Springer-Verlag, New York, NY, 1992.]] Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Preliminary design of JML: a behavioral interface specification language for java

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGSOFT Software Engineering Notes
          ACM SIGSOFT Software Engineering Notes  Volume 31, Issue 3
          May 2006
          171 pages
          ISSN:0163-5948
          DOI:10.1145/1127878
          Issue’s Table of Contents

          Copyright © 2006 Authors

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 1 May 2006

          Check for updates

          Qualifiers

          • article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader