paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Large-scale study of substitutability in the presence of effects

存在效应情况下的可替换性:一项大规模研究
FSE Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering2018匹配度 3/10 · 论文属于程序分析与副作用研究,和 PL/静态分析领域相邻,但未涉及用户核心关注的 LLM/Agent、浮点程序分析、贝叶斯程序分析或 AI↔PL 交叉,因此匹配度较低。引用 2 inbox
Jackson Maddox, Yuheng Long, Hridesh Rajan
crossref: 2026-09-12

AI 速览

一句话:对超 2000 万 Java 类的大规模分析表明,子类与超类方法在异常、同步、I/O 和方法调用效应上普遍不满足可替换性。

现代软件普遍依赖读写文件、抛异常、加锁等副作用。开发者在用子类替换超类时,需要保证替换在行为上安全,即可替换性;若子类方法与超类方法的效应不一致,可能导致程序缺陷。本文对超过 2000 万个 Java 类开展大规模实证研究,比较子类与超类方法在异常、同步、I/O 和方法调用上的效应。结果表明,在含效应的类对中,仅 8–24% 的子类方法与超类方法具有相同效应,31–56% 的子类方法具有更多效应,且很大比例子类方法的效应无法从对应超类方法推断。这说明实践中效应层面的可替换性普遍不成立,亟需更好的效应规格与分析支持。

问题
子类与超类方法在效应上的可替换性是否在实践中成立,以及常见违规类型和影响尚不清楚。
方法
对超过 2000 万个 Java 类进行大规模实证研究,比较子类与超类方法在异常、同步、I/O 和方法调用上的效应。
评估
通过统计子类与超类方法效应的异同,量化相同效应、更多效应及无法从超类方法推断的比例,例如 8–24% 和 31–56%。
原文摘要(Abstract)

A majority of modern software is constructed using languages that compute by producing side-effects such as reading/writing from/to files, throwing exceptions, acquiring locks, etc. To understand a piece of software, e.g. a class, it is important for a developer to understand its side-effects. Similarly, to replace a class with another, it is important to understand whether the replacement is a safe substitution for the former in terms of its behavior, a property known as substitutability, because mismatch may lead to bugs. The problem is especially severe for superclass-subclass pairs since at runtime an instance of the subclass may be used in the client code where a superclass is mentioned. Despite the importance of this property, we do not yet know whether substitutability w.r.t. effects between subclass and superclass is preserved in the wild, and if not what sorts of substitutability violations are common and what is the impact of such violations. This paper conducts a large scale study on over 20 million Java classes, in order to compare the effects of the methods of subclasses and superclasses in practice. Our comprehensive study considers the exception, synchronization, I/O, and method call effects. It reveals that in pairs with effects, only 8-24% have the same effects, and 31-56% of submethods have more effects, and the effects of a large percentage of submethods cannot be inferred from the supermethod.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot4630,
  title = {Large-scale study of substitutability in the presence of effects},
  author = {Jackson Maddox and Yuheng Long and Hridesh Rajan},
  booktitle = {FSE},
  year = {2018},
  doi = {10.1145/3236024.3236075}
}