REPFINDER: Finding Replacements for Missing APIs in Library Update
Kaifeng Huang, Bihuan Chen, Linghao Pan, Shuai Wu, Xin Peng
摘要
Libraries are widely adopted in developing software projects. Library APIs are often missing during library evolution as library developers may deprecate, remove or refactor APIs. As a result, client developers have to manually find replacement APIs for missing APIs when updating library versions in their projects, which is a difficult and expensive software maintenance task. One of the key limitations of the existing automated approaches is that they usually consider the library itself as the single source to find replacement APIs, which heavily limits their accuracy. In this paper, we first present an empirical study to understand characteristics about missing APIs and their replacements. Specifically, we quantify the prevalence of missing APIs, and summarize the knowledge sources where the replacements are found, and the code change and mapping cardinality between missing APIs and their replacements. Then, inspired by the insights from our study, we propose a heuristic-based approach, REPFINDER, to automatically find replacements for missing APIs in library update. We design and combine a set of heuristics to hierarchically search three sources (deprecation message, own library, and external library) for finding replacements. Our evaluation has demonstrated that REPFINDER can find replacement APIs effectively and efficiently, and significantly outperform the state-of-the-art approaches. TABLE I. Examples of Missing APIs and Their Replacements in Library Update No. Library Version Update Missing API Replacement API Source 1 org.mapdb mapdb 0.9.3 0.9.13 org.mapdb. DBMaker.writeAheadLogDisable() org.mapdb. DBMaker.transactionDisable() Deprecation Message 2 org.apache.lucene lucene-core 5.1.0 6.0.0 org.apache.lucene.search. PhraseQuery.add(Term) org.apache.lucene.search. PhraseQuery.Builder.add(Term) Own Library 3 org.apache.lucene lucene-core 3.0.3 4.0.0 org.apache.lucene.analysis.standard. StandardAnalyzer.StandardAnalyzer(Version) org.apache.lucene.analysis.standard. StandardAnalyzer.StandardAnalyzer(Version) Vendor Library 4 org.elasticsearch elasticsearch 1.7.1 2.0.0 org.elasticsearch.common.joda.time.format. DateTimeFormatter.print(long) org.joda.time.format. DateTimeFormatter.print(long) Dependency Library 5 org.elasticsearch elasticsearch 0.20.6 1.2.1 org.elasticsearch.common.trove.list.array. TIntArrayList.toArray()
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 2 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Keep me Updated: An Empirical Study of Third-Party Library Updatability on Android 引用了 Thou Shalt Not Depend on Me: Analysing the Use of Outdated JavaScript Libraries on the Web
- LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-Based Code Completion 引用了 Exploring how deprecated Python library APIs are (not) handled
- Small World with High Risks: A Study of Security Threats in the npm Ecosystem 引用了 Thou Shalt Not Depend on Me: Analysing the Use of Outdated JavaScript Libraries on the Web
引用它的顶会 Paper2
- LLMs Meet Library Evolution: Evaluating Deprecated API Usage in LLM-Based Code CompletionChong Wang, Kaifeng Huang, Jian Zhang, Yebo Feng 等ICSE 2025 · 3 次引用
- Your "Notice" Is Missing: Detecting and Fixing Violations of Modification Terms in Open Source Licenses during ForkingKaifeng Huang, Yingfeng Xia, Bihuan Chen, Siyang He 等ISSTA 2024 · 3 次引用
它引用的 Paper8
- Small World with High Risks: A Study of Security Threats in the npm EcosystemMarkus Zimmermann, Cristian-Alexandru Staicu, Cam Tenny, Michael PradelUSENIX Security 2019 · 281 次引用
- Keep me Updated: An Empirical Study of Third-Party Library Updatability on AndroidErik Derr, Sven Bugiel, Sascha Fahl, Yasemin Acar 等CCS 2017 · 196 次引用
- Thou Shalt Not Depend on Me: Analysing the Use of Outdated JavaScript Libraries on the WebTobias Lauinger, Abdelberi Chaabane, Sajjad Arshad, William Robertson 等NDSS 2017 · 183 次引用
- Watchman: monitoring dependency conflicts for Python library ecosystemYing Wang, Ming Wen, Yepang Liu, Yibo Wang 等ICSE 2020 · 65 次引用
- Exploring how deprecated Python library APIs are (not) handledJiawei Wang, Li Li, Kui Liu, Haipeng CaiFSE 2020 · 52 次引用
相关 Paper
- Compiler-directed Migrating API Callsite of Client CodeHao Zhong, Na MengICSE 2024 · 5 次引用
- Interactive, effort-aware library version harmonizationKaifeng Huang, Bihuan Chen, Bowen Shi, Ying Wang 等FSE 2020 · 32 次引用
- Understanding Breaking Changes in the WildDhanushka Jayasuriya, Valerio Terragni, Jens Dietrich, Samuel Ou 等ISSTA 2023 · 19 次引用
- Break to Adapt: Knowledge-Based Updates of Breaking Dependencies in JavaScriptYifan Xia, Chengwei Liu, Zifan Xie, Lyuye Zhang 等FSE 2026
- Recommending Analogical APIs via Knowledge Graph EmbeddingMingwei Liu, Yanjun Yang, Yiling Lou, Xin Peng 等FSE 2023 · 8 次引用
