Specifying subtypes in Safety Critical Java programs - Haddad, Ghaith; Leavens, Gary T. (Concurrency and computation, 2013)
SUMMARYReal‐time and safety‐critical code could benefit from the use of design patterns and frameworks that rely on subtyping and dynamic dispatch. However, modular reasoning about programs that use subtypes requires that each overriding method obeys the specifications of all methods that it overrides. For example, if method scale is specified in a supertype Vector2d to take at most 42 ns to execute, then an override of scale cannot take more than 42 ns to execute in any subtype, such as Vector3d. The problem is that subtype objects typically contain more information, such as the z coordinate in Vector3d, and thus their methods often require more time to execute than the methods they override. In this paper, we show how to specify timing constraints for subtypes in a way that both allows overriding subtype methods to have more time to execute and yet permits precise modular verification and checking of timing constraints. Our techniques allow object‐oriented coding and design patterns based on subtype polymorphism to be used in real‐time and safety‐critical software. Copyright © 2012 John Wiley & Sons, Ltd.