ABSTRACT
The Java Modeling Language (JML) is a language for specifying the behavior of Java source code. However, it can describe the protocols of Java classes and interfaces only implicitly. Typestate protocol specification is a more direct, lightweight and abstract way of documenting usage protocols for object-oriented programs. In this paper, we propose a technique for incorporating the typestate concept into JML for specifying protocols of Java classes and interfaces, based on our previous research on typestate protocol specifications [4]. This paper presents a set of formal translation rules for encoding typestate protocol specifications into pre/post-condition specifications. It shows how typestate protocol specifications can be mixed with pre/post-condition specifications and how violations of code contracts in inheritance can be handled. Finally, our proposed technique is demonstrated within the Java/JML environment to show its effectiveness.
- G. T. Leavens, A. L. Baker, and C. Ruby. Preliminary design of JML: A behavioral interface specification language for Java. Technical Report 98-06-rev28, Iowa State University Department of Computer Science, July 2005.Google Scholar
- Gary T. Leavens, Erik Poll, Curtis Clifton, Yoonsik Cheon, Clyde Ruby, David Cok, Peter Müller, Joseph Kiniry, Patrice Chalin, and Daniel M. Zimmerman. JML reference manual. Available at http://www.eecs.ucf.edu/~leavens/JML/jmlrefman/, retrieved June 2009.Google Scholar
- Jean-Raymond Abrial, Stephen A. Schuman and Bertrand Meyer. A Specification Language. In On the Construction of Programs, Cambridge University Press, 1980.Google Scholar
- Kevin Bierhoff and Jonathan Aldrich, Lightweight Object Specification with Typestates. In Foundations of Software Engineering, September 2005. Google Scholar
Digital Library
- Edmund M. Clarke, Jeannette M. Wing, et al., Formal Methods: State of the Art and Future Directions. ACM Computing Surveys, Vol. 28, No. 4, December 1996. Google Scholar
Digital Library
- R. E. Strom and S. Yemini. Typestate: A programming language concept for enhancing software reliability. IEEE Transactions on Software Engineering, 12:157--171, 1986 Google Scholar
Digital Library
- R. DeLine and M. Fähndrich. Typestates for objects. In European Conference on Object-Oriented Programming. Springer-Verlag, 2004.Google Scholar
Cross Ref
- C. A. R. Hoare. "An axiomatic basis for computer programming". Communications of the ACM, 12(10):576--580, 1969. Google Scholar
Digital Library
- Gary T. Leavens. JML's Rich, Inherited Specifications for Behavioral Subtypes. In International Conference on Formal Engineering Methods, pp. 2--34, 2006. Google Scholar
Digital Library
- S. Butkevich, M. Renedo, G. Baumgartner, and M. Young. Compiler and tool support for debugging object protocols. In Foundations of Software Engineering, 2000. Google Scholar
Digital Library
- B. Meyer. Eiffel: The Language. Prentice Hall, 1992. Google Scholar
Digital Library
- R. Duke, G. Rose, and G. Smith. Object-z: A specification language advocated for the description of standards. Computer Standards and Interfaces, 17:511--533, 1995. Google Scholar
Digital Library
- D. Harel. Statecharts: A visual formalism for complex systems. Sci. Comput. Programming, 8:231--274, 1987. Google Scholar
Digital Library
- Mike Barnett, K. Rustan M. Leino, and Wolfram Schulte. The Spec# programming system: An overview. In Construction and Analysis of Safe, Secure, and Interoperable Smart Devices, 2004. Google Scholar
Digital Library
- Cheon, Y., Perumendla, A. 2005. Specifying and checking method call sequences in JML. In: Arabnia, H. R., Reza, H. (eds.), Proceedings of the 2005 International Conference on Software Engineering Research and Practice (SERP'05). vol. II, June 27-29, 2005, Las Vegas, Nevada, CSREA Press, pp. 511--516.Google Scholar
- Kevin Bierhoff, Nels E. Beckman, and Jonathan Aldrich. Practical API Protocol Checking with Access Permissions. In Proceedings of the 23rd European Conference on Object-Oriented Programming (ECOOP'09) (Genova, Italy, July 2009). to appear. Google Scholar
Digital Library
Index Terms
- Typestate protocol specification in JML
Recommendations
Lightweight object specification with typestates
Previous work has proven typestates to be useful for modeling protocols in object-oriented languages. We build on this work by addressing substitutability of subtypes as well as improving precision and conciseness of specifications. We propose a ...
Lightweight object specification with typestates
ESEC/FSE-13: Proceedings of the 10th European software engineering conference held jointly with 13th ACM SIGSOFT international symposium on Foundations of software engineeringPrevious work has proven typestates to be useful for modeling protocols in object-oriented languages. We build on this work by addressing substitutability of subtypes as well as improving precision and conciseness of specifications. We propose a ...
Typestate-like analysis of multiple interacting objects
OOPSLA '08: Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applicationsThis paper presents a static analysis of typestate-like temporal specifications of groups of interacting objects, which are expressed using tracematches. Whereas typestate expresses a temporal specification of one object, a tracematch state may change ...





Comments