1. Resource Contracts for Java
- Author
-
Martin Schäf, Rody Kersten, and Temesghen Kahsai
- Subjects
Enumerated type ,Java ,Programming language ,Computer science ,business.industry ,Assertion ,020207 software engineering ,Static program analysis ,02 engineering and technology ,General Medicine ,Design by contract ,computer.software_genre ,Bytecode ,0202 electrical engineering, electronic engineering, information engineering ,020201 artificial intelligence & image processing ,Program behavior ,Software engineering ,business ,computer ,Time complexity ,computer.programming_language - Abstract
Writing specifications about program behavior is hard. Writing specifications about non-functional effects such as resource usage is often even harder. If manually instrumenting the program is not an option, programmers have to rely on comment-based specification languages like JML to introduce ghost variables and other fairly abstract concepts that are complicated and hard to maintain. Even worse, most static analysis tools nowadays operate on bit- or bytecode and cannot process those type of specifications To address this problem, we propose a library-based specification formalism for time complexity in Java. The approach is inspired by the success of assertion libraries like CodeContracts and Guava. Our library provides a set of methods and enumerated types that allow the user to write complexity assertions in a 'human' readable form and without instrumenting the code. On the backend, we provide a bytecode rewriting tool that uses these assertions to automatically instrument the program with counter variables. The transformed program can then be checked via testing or off-the-shelf automated static analyzers
- Published
- 2017
- Full Text
- View/download PDF