TY - CPAPER TI - Comprehending Object State via Dynamic Class Invariant Learning AU - Boockmann, Jan H. AU - Lüttgen, Gerald PY - 2024 T2 - Fundamental Approaches to Software Engineering : 27th International Conference, FASE 2024, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2024, Luxembourg City, Luxembourg, April 6–11, 2024, Proceedings SP - 143-164 PB - Springer Nature Switzerland CY - Cham SN - 978-3-031-57258-6 DO - 10.1007/978-3-031-57259-3_7 UR - https://fis.uni-bamberg.de/handle/uniba/98466 LA - eng AB - Maintaining software is cumbersome when method argument constraints are undocumented. To reveal them, previous work learned preconditions from exemplary valid and invalid method arguments. In practice, it would be highly beneficial to know class invariants, too, because functionality added during software maintenance must not break them. Even more so than method preconditions, class invariants are rarely documented and often cannot completely be inferred automatically, especially for objects exhibiting complex state such as dynamic data structures. This paper presents a novel dynamic approach to learning class invariants, thereby complementing related work on learning method preconditions. We automatically synthesize assertions from an adjustable assertion grammar to distinguish valid and invalid objects. While random walks generate valid objects, a combination of bounded-exhaustive testing techniques and behavioral oracles yield invalid objects. The utility of our approach for code comprehension and software maintenance is demonstrated by comparing our learned invariants to documented invariant validation methods found in real-world Java classes and to the invariants detected by the Daikon tool. KW - Dynamic Class Invariant Learning ER -