Preview

Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS)

Advanced search

Kotlin from the perspective of a static analyzer developer

https://doi.org/10.15514/ISPRAS-2021-33(6)-5

Abstract

The paper describes a static analysis for finding defects and computing metrics for programs written in the Kotlin language. The analysis is implemented in the Svace static analyzer developed at ISP RAS. The paper focuses on the problems we met during implementation, the approaches we used to solve them, and the experimental results for the tool we have built.  The analyzer supports not only Kotlin analysis, but is also capable of analyzing mixed projects that use both Java and Kotlin languages.  We hope that the paper might be useful to static analysis developers and language designers.

About the Authors

Vitaly Olegovich AFANASYEV
Ivannikov Institute for System Programming of the Russian Academy of Sciences, National Research University Higher School of Economics
Russian Federation

Undergraduate student at the Faculty of Computer Science, NRU HSE, employee of ISP RAS



Sergey Andreevich POLYAKOV
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

Researcher



Alexey Evgenevich BORODIN
Ivannikov Institute for System Programming of the Russian Academy of Sciences
Russian Federation

PhD, researcher



Andrey Andreevich BELEVANTSEV
Ivannikov Institute for System Programming of the Russian Academy of Sciences, Lomonosov Moscow State University
Russian Federation

Dr.Sc., Leading Researcher at ISP RAS, Professor at MSU



References

1. JetBrains s.r.o. URL: https://www.jetbrains.com, accessed October 6, 2021.

2. P. Miller. Google is adding Kotlin as an official programming language for Android development. URL: https://www.theverge.com/2017/5/17/15654988/google-jet-brains-kotlin-programming-language-android-development-io-2017, accessed October 6, 2021.

3. The Java Virtual Machine Specification. Java SE 8 Edition. URL: https://docs.oracle.com/javase/specs/jvms/se8/html, accessed October 6, 2021.

4. C.A.R. Hoare. Null references: the billion dollar mistake. Presentation at QCon, 2009-08-25. URL: https://www. infoq.com/presentations/null-references-the-billion-dollar-mistake-tony-hoare, accessed October 6, 2021.

5. Detekt analyzer. URL: https://detekt.github.io/detekt, accessed October 6, 202.

6. An anti-bikeshedding Kotlin linter with built-in formatter. URL: https://ktlint.github.io, accessed October 6, 2021.

7. В.П. Иванников, А.А. Белеванцев и др. Статический анализатор Svace для поиска дефектов в исходном коде программ. Труды ИСП РАН, том 26, вып. 1, 2014 г., стр. 231-250 / V.P. Ivannikov, A.A. Belevantsev et al. Static analyzer Svace for finding of defects in program source code. Trudy ISP RAN/Proc. ISP RAS, vol. 26, issue 1, 2014, pp. 231-250 (in Russian). DOI: 10.15514/ISPRAS-2014-26(1)-7.

8. А. Е. Бородин, А. А. Белеванцев. Статический анализатор Svace как коллекция анализаторов разных уровней сложности. Труды ИСП РАН, том 27, вып. 6, 2015 г., стр. 111-134 / A.E. Borodin, A.A. Belevantsev. A static analysis tool Svace as a collection of analyzers with various complexity levels. Trudy ISP RAN/Proc. ISP RAS, vol. 27, issue 6, 2015, pp. 111-134 (in Russian). DOI: 10.15514/ISPRAS-2015-27(6)-8.

9. А.А. Белеванцев, А.О. Избышев, Д.М. Журихин. Организация контролируемой сборки в статическом анализаторе svace. Системный администратор, вып. 7-8, 2017 г., стр. 135-139 / A.A. Belevantsev, A.O. Izbyshev, D.M. Zhurikhin. Monitoring program builds for Svace static analyzer. System Administrator, issues 7-8, 2017, pp/ 135-139 (in Russian).

10. Package java.lang.instrument. URL: https://docs.oracle.com/javase/7/docs/api/java/lang/instrument/package-summary.html, accessed October 6, 2021.

11. Kotlin Evolution. URL: https://kotlinlang.org/docs/kotlin-evolution.html, accessed October 6, 2021.

12. Using kapt. URL: https://kotlinlang.org/docs/kapt.html, accessed October 6, 2021.

13. А.П. Меркулов, С.А. Поляков, А.А. Белеванцев. Анализ программ на языке Java в инструменте Svace. Труды ИСП РАН, том 29, вып. 3, 2017 г., стр. 57-74 / A.P. Merkulov, S.A. Polyakov, A.A. Belevantsev. Supporting Java programming in the Svace static analyzer. Trudy ISP RAN/Proc. ISP RAS, vol. 29, issue 3, 2017. pp. 57-74 (in Russian). DOI: 10.15514/ISPRAS-2017-29(3)-5.

14. А.Е. Бородин, И.А. Дудина. Внутрипроцедурный анализ для поиска ошибок на основе символьного выполнения. Труды ИСП РАН, том 32, вып. 6, 2020 г., стр. 87-100 / A.E. Borodin, I.A. Dudina. Symbolic Execution Based Intra-Procedural Analysis for Search for Defects. Trudy ISP RAN/Proc. ISP RAS, vol. 32, issue 6, 2020, pp. 87-100 (in Russian). DOI: 10.15514/ISPRAS-2020-32(6)-7

15. А.А. Белеванцев, Е.А. Велесевич. Анализ сущностей программ на языках Си/Си++ и связей между ними для понимания программ. Труды ИСП РАН, том 27, вып. 2, 2015 г., стр. 53-64 / A.A. Belevantsev, E.A. Velesevich. Analyzing C/C++ Code Entities and Relations for Program Understanding. Trudy ISP RAN/Proc. ISP RAS, vol. 27, issue 2, 2015, pp. 53-64 (in Russian). DOI: 10.15514/ISPRAS-2015-27(2)-4.

16. Kotlin compiler project. URL: https://github.com/JetBrains/kotlin, accessed October 19, 2021.


Review

For citations:


AFANASYEV V.O., POLYAKOV S.A., BORODIN A.E., BELEVANTSEV A.A. Kotlin from the perspective of a static analyzer developer. Proceedings of the Institute for System Programming of the RAS (Proceedings of ISP RAS). 2021;33(6):67-82. (In Russ.) https://doi.org/10.15514/ISPRAS-2021-33(6)-5



Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


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