paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Verifying the Option Type with Rely-Guarantee Reasoning

使用依赖-保证推理验证 Option 类型
ASE Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering2024匹配度 4/10 · 这是一篇扎实的静态验证工作(依赖-保证推理、Option 类型误用检测、百万行级实证与工业工具对比),属于程序验证/静态分析的经典路线,但用户画像的四个核心方向(PL→AI 的 Agentic/ML 程序静态分析、AI→PL 的 LLM 辅助验证、浮点程序分析、贝叶斯程序分析)一个都未涉及,与 LLM/Agent 及浮点、贝叶斯均无交叉。仅其“理论形式化 + 工程实现 + 工业级评测”的风格与用户偏好相符,可作为方法论参考。引用 1 inbox
James Yoo, Michael D. Ernst, René Just
crossref: 2026-09-12dblp: 2026-09-12

AI 速览

一句话:首个基于可靠理论的 Option 类型误用静态验证器,结合依赖-保证推理与大规模实证研究。

Option 类型的误用会引发运行时错误,不当风格也会产生冗余代码,但此前缺乏对强制正确性与风格工具的评估。作者提出两个通过新型依赖-保证推理协作的模块化验证器,并实现为开源静态验证器 Optional Checker;同时综述风格最佳实践并加入 lint 规则。在 100 万行非注释非空代码上与 SpotBugs、Error Prone、IntelliJ IDEA 比较,Optional Checker 发现 13 个新 bug(覆盖其他工具)且精度 93%;风格检查发现数百处违反 Oracle 建议,含 11% 使用 Optional 的 JDK 文件。

问题
Option 类型的错误使用会导致运行时错误,而不符合风格的用法会产生冗余代码;已有缓解工具但缺乏可靠性保证与系统评估。
方法
设计两个通过新型依赖-保证推理协作的模块化验证器,并集成到开源静态验证器 Optional Checker,以可靠理论保证 Option 类型使用正确;同时实现风格 lint 规则。
评估
在约 100 万行 Java 代码上与 SpotBugs、Error Prone、IntelliJ IDEA 对比;Optional Checker 发现 13 个新 bug 且精度 93%,并发现大量 Oracle 风格违规,包括 11% 使用 Optional 的 JDK 文件。
原文摘要(Abstract)

Many programming languages include an implementation of the option type, which encodes the absence or presence of values. Incorrect use of the option type results in run-time errors, and unstylistic use results in unnecessary code. Researchers and practitioners have tried to mitigate the pitfalls of the option type, but have yet to evaluate tools for enforcing correctness and good style.To address problems of correctness, we developed two modular verifiers that cooperate via a novel form of rely–guarantee reasoning; together, they verify use of the option type. We implemented them in the Optional Checker, an open-source static verifier. The Optional Checker is the first verifier for the option type based on a sound theory — that is, it issues a compile-time guarantee of the absence of run-time errors related to misuse of the option type. We then conducted the first mechanized study of tools that aim to prevent run-time errors related to the option type. We compared the performance of the Optional Checker, SpotBugs, Error Prone, and IntelliJ IDEA over 1M non-comment, non-blank lines of code. The Optional Checker found 13 previously-undiscovered bugs (a superset of those found by all other tools) and had the highest precision at 93%.To address problems of style, we conducted a literature review of best practices for the option type. We discovered widely varying opinions about proper style. We implemented linting rules in the Optional Checker and discovered hundreds of violations of the style recommended by Oracle, including in 11% of JDK files that use Optional. Some of these were objectively bad code, and others reflected different styles.CCS CONCEPTS • Software and its engineering → Software verification and validation.

链接与引用

DOI 原文 · PDF(开放获取) · DBLP

BibTeX
@inproceedings{YooEJ24,
  title = {Verifying the Option Type with Rely-Guarantee Reasoning},
  author = {James Yoo and Michael D. Ernst and René Just},
  booktitle = {ASE},
  year = {2024},
  doi = {10.1145/3691620.3695036}
}