Proceedings of ISP RAS

Supporting Java programming in the Svace static analyzer

A. Merkulov (ISP RAS, Moscow, Russia)
S. Polyakov (ISP RAS, Moscow, Russia)
A. Belevantsev (ISP RAS, Moscow, Russia; MSU, Moscow, Russia)


The paper is devoted to the works performed within the Svace static analysis tool to support Java language. First, the approach to intercept compilation process for transparently building the analyzer internal representation should be extended to cover usage of the Java compiler API that is popular in Ant and Maven tools. We achieve this goal with implementing our custom Java agent that instruments all calls to the compiler API and notifies the analyzer with the actual compilation parameters. Second, the modified Javac compiler builds the analyzer IR. The changes we made to the compiler include avoiding unnecessary bytecode duplication for easier mapping of bytecode instructions to source code and properly marking the code added by the compiler itself. Third, we discuss the process of bytecode translation to the Svace IR proper (which is a low-level 3-address IR akin to the LLVM IR). It is a straightforward code generation algorithm with further code cleanups that treats stack locations as local variables made possible by the fact that we know the maximum stack size consumed by the method. Finally, we discuss the devirtualization heuristics that assume we know the full class hierarchy and specific Java checkers including synchronization issue checkers. Experimental results obtained on Android 5 source code show that the checkers have high quality (more than 80% true positives). It can be seen that the general infrastructure for analysis and checkers implemented in Svace works well for the Java programming language with the adaptations described in the paper.


static analysis; Java; bytecode; devirtualization


Proceedings of the Institute for System Programming, vol. 29, issue 3, 2017, pp. 57-74.

ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).

DOI: 10.15514/ISPRAS-2017-29(3)-5

For citation

A. Merkulov, S. Polyakov, A. Belevantsev Supporting Java programming in the Svace static analyzer. Proceedings of the Institute for System Programming, vol. 29, issue 3, 2017, pp. 57-74. DOI: 10.15514/ISPRAS-2017-29(3)-5.

Full text of the paper in pdf (in Russian) Back to the contents of the volume