Automated code generation is an enabling technology for model-based software development and promises many benefits, including higher quality and reduced turn-around times. However, the key to realizing these benefits is generator correctness: nothing is gained from replacing manual coding errors with automatic coding errors. In this paper, we describe an alternative technique that uses a generic post-generation annotation inference algorithm. We exploit both the highly idiomatic structure of automatically generated code and the restriction to specific safety properties. Since generated code only constitutes a limited subset of all possible programs, the new "eureka" insights required in general remain rare in our case. Since safety properties are simpler than full functional correctness, the required annotations are also simpler and more regular. We can thus use patterns to describe all code constructs that require annotations and templates to describe the required annotations. We use techniques similar to aspect-oriented programming to add the annotations to the generated code: the patterns correspond to (static) point-cut descriptors, while the introduced annotations correspond to advice. The annotation inference algorithm can run completely separately from the generator and is generic with respect to the safety property, although we use initialization safety as running example here. It has been implemented and applied to certify initialization safety for code generated by Auto-Bayes and AutoFilter
[1]
Ewen Denney,et al.
Correctness of Source-Level Safety Policies
,
2003,
FME.
[2]
Ingo Stürmer,et al.
Overview of existing safeguarding techniques for automatically generated code
,
2005,
ACM SIGSOFT Softw. Eng. Notes.
[3]
Ewen Denney,et al.
Certifiable program generation
,
2005,
GPCE'05.
[4]
Johann Schumann,et al.
Under Consideration for Publication in J. Functional Programming Autobayes: a System for Generating Data Analysis Programs from Statistical Models
,
2022
.
[5]
K. Rustan M. Leino,et al.
Houdini, an Annotation Assistant for ESC/Java
,
2001,
FME.
[6]
Ben Wegbreit,et al.
The synthesis of loop predicates
,
1974,
CACM.
[7]
William G. Griswold,et al.
Dynamically discovering likely program invariants to support program evolution
,
1999,
Proceedings of the 1999 International Conference on Software Engineering (IEEE Cat. No.99CB37002).
[8]
Johann Schumann,et al.
Automating the implementation of Kalman filter algorithms
,
2004,
TOMS.