基于数据流分析的冗余空值检查检测方法

DETECTING REDUNDANT NULL CHECKS BASED ON DATAFLOW ANALYSIS

  • 摘要: 冗余空值检查会导致死代码,降低代码的可理解性和效率,并且预示程序可能有错。提出一种基于数据流分析的冗余空值检查的检测方法RedDetector。这种方法增强了数据流分析,并且能够找到更多冗余空值检查。搜集35个GitHub热门项目,并人工搜集其中的冗余空值检查作为数据集。在这个数据集上,对比最先进工具,RedDetector的不可达空值检查语句查全率提升了83.7百分点,查准率提升了54.4百分点;而必可达空值检查语句的查全率提升了75.4百分点,查准率提升了44.7百分点。

     

    Abstract: Redundant null check can result in dead code, hinder code comprehension and efficiency, and indicate that the program may contain bugs. This paper proposes RedDetector, an approach to detect redundant null checks based on dataflow analysis. This approach could detect more redundant null checks by enhancing dataflow analysis. We collected 35 popular GitHub projects and manually collected their redundant null checks into a dataset. Based on the dataset, compared with a state-of-the-art tool, the precision and recall of the unreachable null check statements detected by RedDetector increased by 83.7 and 54.4 percentage points respectively. The precision and recall of the certainly-reachable null check statements detected by RedDetector increased by 75.4 and 44.7 percentage points.

     

/

返回文章
返回