Pluggable checking and inferencing of nonnull types for Java

Pluggable checking and inferencing of nonnull types for Java
复制标题

Java 非空类型的可插入检查和推断

DOI:
--
复制
发表时间:
2007
影响因子:
0.8
通讯作者:
G. Hedin
G. Hedin
中科院分区:
--
文献类型:
--
作者:
Torbjörn Ekman;G. Hedin

文献摘要

被引文献

相似文献

我们为 Java 实现了一个非空类型检查器和一个新的非空推理算法来分析遗留代码。这些工具是 JastAdd 可扩展 Java 编译器的模块化扩展,说明了如何实现可插入类型系统。最终的实现非常紧凑,非空检查器的代码少于 230 行,推理器的代码少于 460 行。非空检查是本地分析,对编译时间影响很小。推理算法是整个程序分析,但其运行速度足以满足实际使用的需要,100,000 行代码不到 10 秒。我们在 JDK 库的很大一部分上运行推理器,并且可以检测到大约 70% 的取消引用和大约 24% 的方法返回值都保证为非空。
We have implemented a non-null type checker for Java and a new non-null inferencing algorithm for analyzing legacy code. The tools are modular extensions to the JastAdd extensible Java compiler, illustrating how pluggable type systems can be achieved. The resulting implementation is compact, less than 230 lines of code for the non-null checker and 460 for the inferencer. Non-null checking is a local analysis with little effect on compilation time. The inferencing algorithm is a whole-program analysis, yet it runs sufficiently fast for practical use, less than 10 seconds for 100.000 lines of code. We ran our inferencer on a large part of the JDK library, and could detect that around 70% of the dereferences, and around 24% of the method return values, were guaranteed to be non-null.