Lazy Behavioral Subtyping

  • Authors:
  • Johan Dovland;Einar Broch Johnsen;Olaf Owe;Martin Steffen

  • Affiliations:
  • Dept. of Informatics, University of Oslo, Norway;Dept. of Informatics, University of Oslo, Norway;Dept. of Informatics, University of Oslo, Norway;Dept. of Informatics, University of Oslo, Norway

  • Venue:
  • FM '08 Proceedings of the 15th international symposium on Formal Methods
  • Year:
  • 2008

Quantified Score

Hi-index 0.00

Visualization

Abstract

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.