Lazy Behavioral Subtyping

Late binding allows flexible code reuse but complicates formal reasoning significantly, as a method call's receiver class is not statically known. This is especially true when programs are incrementally developed by extending class hierarchies. This paper develops a novel method to reason about late bound method calls. In contrast to traditional behavioral subtyping, reverification is avoided without restricting method overriding to fully behavior-preserving redefinition. The approach ensures that when analyzing the methods of a class, it suffices to consider that class and its superclasses. Thus, the full class hierarchy is not needed, and incrementalreasoning is supported. We formalize this approach as a calculus which lazily imposes context-dependent subtyping constraints on method definitions. The calculus ensures that all method specifications required by late bound calls remain satisfied when new classes extend a class hierarchy. The calculus does not depend on a specific program logic, but the examples in the paper use a Hoare-style proof system. We show soundness of the analysis method.

[1]  Johan Dovland,et al.  Observable Behavior of Dynamic Systems: Component Reasoning for Concurrent Objects , 2008, FInCo@ETAPS.

[2]  Gary T. Leavens,et al.  Specification and verification challenges for sequential object-oriented programs , 2007, Formal Aspects of Computing.

[3]  Ole-Johan Dahl Verifiable programming , 1992, Prentice Hall international series in computer science.

[4]  Johan Dovland,et al.  Lazy behavioral subtyping , 2010, J. Log. Algebraic Methods Program..

[5]  Neelam Soundarajan,et al.  Enforcing behavioral constraints in evolving aspect-oriented programs , 2008, FOAL.

[6]  Susan Owicki,et al.  An axiomatic proof technique for parallel programs I , 1976, Acta Informatica.

[7]  Gary T. Leavens,et al.  Obliviousness, Modular Reasoning, and the Behavioral Subtyping Analogy , 2003 .

[8]  C. A. R. HOARE,et al.  An axiomatic basis for computer programming , 1969, CACM.

[9]  C. A. R. Hoare,et al.  An axiomatic basis for computer programming , 1969, CACM.

[10]  Shengchao Qin,et al.  Separation Logic for Multiple Inheritance , 2008, Electron. Notes Theor. Comput. Sci..

[11]  Frank S. de Boer,et al.  A proof outline logic for object-oriented programming , 2005, Theor. Comput. Sci..

[12]  Arnd Poetzsch-Heffter,et al.  A Programming Logic for Sequential Java , 1999, ESOP.

[13]  Neelam Soundararajan,et al.  Axiomatic semantics of communicating sequential processes , 1984, ACM Trans. Program. Lang. Syst..

[14]  Gary T. Leavens,et al.  Reasoning about object-oriented programs that use subtypes , 1990, OOPSLA/ECOOP '90.

[15]  Johan Dovland,et al.  Incremental Reasoning for Multiple Inheritance , 2009, IFM.

[16]  Heike Wehrheim Behavioral Subtyping Relations for Active Objects , 2003, Formal Methods Syst. Des..

[17]  Neelam Soundarajan,et al.  Inheritance: from code reuse to reasoning reuse , 1998, Proceedings. Fifth International Conference on Software Reuse (Cat. No.98TB100203).

[18]  C. A. R. Hoare,et al.  Procedures and parameters: An axiomatic approach , 1971, Symposium on Semantics of Algorithmic Languages.

[19]  Martín Abadi,et al.  A Logic of Object-Oriented Programs , 1997, Verification: Theory and Practice.

[20]  Suad Alagic,et al.  Behavioral Compatibility of Self-Typed Theories , 2002, ECOOP.

[21]  Anish Arora,et al.  Book Review: Verification of Sequential and Concurrent Programs by Krzysztof R. Apt and Ernst-Riidiger Olderog (Springer-Verlag New York, 1997) , 1998, SIGA.

[22]  Manfred Broy,et al.  Specification and Development of Interactive Systems , 2001, Monographs in Computer Science.

[23]  Gary T. Leavens,et al.  Weak behavioral subtyping for types with mutable objects , 1995, MFPS.

[24]  K. Rustan M. Leino,et al.  The Spec# Programming System: An Overview , 2004, CASSIS.

[25]  Frank S. de Boer,et al.  A WP-calculus for OO , 1999, FoSSaCS.

[26]  Frank S. de Boer,et al.  On Behavioral Subtyping and Completeness , 2005 .

[27]  Krzysztof R. Apt,et al.  Ten Years of Hoare's Logic: A Survey—Part I , 1981, TOPL.

[28]  Shengchao Qin,et al.  Enhancing modular OO verification with separation logic , 2008, POPL '08.

[29]  Einar Broch Johnsen,et al.  An Asynchronous Communication Model for Distributed Concurrent Objects , 2004, Proceedings of the Second International Conference on Software Engineering and Formal Methods, 2004. SEFM 2004..

[30]  Gary T. Leavens,et al.  Forcing behavioral subtyping through specification inheritance , 1996, Proceedings of IEEE 18th International Conference on Software Engineering.

[31]  Bernhard Beckert,et al.  Verification of Object-Oriented Software. The KeY Approach - Foreword by K. Rustan M. Leino , 2007, The KeY Approach.

[32]  Michael D. Ernst,et al.  An overview of JML tools and applications , 2003, Electron. Notes Theor. Comput. Sci..

[33]  Tobias Nipkow,et al.  Hoare Logic for NanoJava: Auxiliary Variables, Side Effects, and Virtual Methods Revisited , 2002, FME.

[34]  Pierre America,et al.  Designing an Object-Oriented Programming Language with Behavioural Subtyping , 1990, REX Workshop.

[35]  Gavin M. Bierman,et al.  Separation logic, abstraction and inheritance , 2008, POPL '08.

[36]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[37]  P. America,et al.  A behavioural approach to subtyping in object-oriented programming languages , 1991 .

[38]  C. A. R. Hoare,et al.  Communicating sequential processes , 1978, CACM.

[39]  Bart Jacobs,et al.  A Logic for the Java Modeling Language JML , 2001, FASE.

[40]  Emil Sekerinski,et al.  A Study of The Fragile Base Class Problem , 1998, ECOOP.

[41]  Einar Broch Johnsen,et al.  Inheritance in the Presence of Asynchronous Method Calls , 2005, Proceedings of the 38th Annual Hawaii International Conference on System Sciences.

[42]  Alan Wills Specification in Fresco , 1992, Object Orientation in Z.

[43]  Jeannette M. Wing,et al.  A behavioral notion of subtyping , 1994, TOPL.

[44]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 1999, OOPSLA '99.

[45]  Frank S. de Boer,et al.  A Complete Guide to the Future , 2007, ESOP.

[46]  Einar Broch Johnsen,et al.  Creol: A type-safe object-oriented model for distributed concurrent systems , 2006, Theor. Comput. Sci..

[47]  Matthias Felleisen,et al.  Contract Soundness for object-oriented languages , 2001, OOPSLA '01.