arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1907.02127cs.SE
收藏

NullAway:一种实用的Java基于类型的安全机制

NullAway: Practical Type-Based Null Safety for Java

Subarno Banerjee, Lazaro Clapp, Manu Sridharan

摘要:

空指针指针(NPE)是现代Java程序中崩溃的主要原因。以前的工作已经展示了如何在编译时通过代码注释和可插入的类型检查来防止此类错误。然而,这样的系统一直难以部署在大规模的软件项目,由于显着的构建时间开销和/或高注释负担。本文介绍了NullAway,一个新的基于类型的空安全检查器的Java,克服了这些问题。NullAway经过精心设计以降低开销,因此它可以作为每个构建的一部分运行。此外,NullAway通过有针对性的不合理假设减少了注释负担,旨在实际上对检查代码没有假阴性。我们的评估表明,NullAway的构建时间开销(1.15倍)明显低于同类工具(2.8- 5.1倍)。此外,在使用NullAway构建的广泛使用的Android应用程序的生产崩溃数据语料库中,剩余的NPE是由于未经检查的第三方库(64%),故意错误支持(17%)或反射和其他形式的检查后代码修改(17%),而不是由于NullAway对检查代码的不合理假设。

英文摘要:

NullPointerExceptions (NPEs) are a key source of crashes in modern Java programs. Previous work has shown how such errors can be prevented at compile time via code annotations and pluggable type checking. However, such systems have been difficult to deploy on large-scale software projects, due to significant build-time overhead and / or a high annotation burden. This paper presents NullAway, a new type-based null safety checker for Java that overcomes these issues. NullAway has been carefully engineered for low overhead, so it can run as part of every build. Further, NullAway reduces annotation burden through targeted unsound assumptions, aiming for no false negatives in practice on checked code. Our evaluation shows that NullAway has significantly lower build-time overhead (1.15X) than comparable tools (2.8-5.1X). Further, on a corpus of production crash data for widely-used Android apps built with NullAway, remaining NPEs were due to unchecked third-party libraries (64%), deliberate error suppressions (17%), or reflection and other forms of post-checking code modification (17%), never due to NullAway's unsound assumptions for checked code.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑