Automatic inference of model fields and their representation
Automatic mining or inference of formal specifications from program source code is a desirable goal for documentation and verification purposes. However, current approaches that generate invariants, pre- and post-conditions, procedure summaries and sometimes also class invariants have mostly focused on extracting specifications from concrete method bodies. Consequently, almost all results have a low level of abstraction that is very close to the analyzed source code.We use JML model fields to raise the abstraction level of such automatically generated specifications, relying on the constraints imposed by behavioral subtyping. Starting from several derived classes we attempt to generate model fields for the supertype and represents clauses for each subtype. The relations between concrete and model fields are generated by checking the validity of predefined patterns against the specifications of subtype methods. Our prototype tool uses as inputs specifications generated with dynamic analysis (Daikon), identifies model fields and their representations, and generates specifications for supertype methods.