Semantic Code Refactoring for Abstract Data Types
Shankara Pailoor, Yuepeng Wang, Isil Dillig
Abstract
Modifications to the data representation of an abstract data type (ADT) can require significant semantic refactoring of the code. Motivated by this observation, this paper presents a new method to automate semantic code refactoring tasks. Our method takes as input the original ADT implementation, a new data representation, and a so-called relational representation invariant (relating the old and new data representations), and automatically generates a new ADT implementation that is semantically equivalent to the original version.
Our method is based on counterexample-guided inductive synthesis (CEGIS) but leverages three key ideas that allow it to handle real-world refactoring tasks. First, our approach reduces the underlying relational synthesis problem to a set of (simpler) programming-by-example problems, one for each method in the ADT. Second, it leverages symbolic reasoning techniques, based on logical abduction, to deduce code snippets that should occur in the refactored version. Finally, it utilizes a notion of partial equivalence to make inductive synthesis much more effective in this setting. We have implemented the proposed approach in a new tool called Revamp for automatically refactoring Java classes and evaluated it on 30 Java class mined from Github. Our evaluation shows that Revamp can correctly refactor the entire ADT in 97% of the cases and that it can successfully re-implement 144 out of the 146 methods that require modifications.
CCS Concepts: • Software and its engineering → Abstract data types.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext bb283230-694a-4ab7-9965-90fa5a86a96dCited by top-tier papers9
- Superfusion: Eliminating Intermediate Data Structures via Inductive SynthesisRuyi Ji, Yuwei Zhao, Nadia Polikarpova, Yingfei Xiong et al.PLDI 2024 · 4 citations
- From Batch to Stream: Automatic Generation of Online AlgorithmsZiteng Wang, Shankara Pailoor, Aaryan Prakash, Yuepeng Wang et al.PLDI 2024 · 4 citations
- Graphiti: Bridging Graph and Relational Database QueriesYang He, Ruijie Fang, Isil Dillig, Yuepeng WangPLDI 2025 · 3 citations
- Relational Synthesis of Recursive Programs via Constraint Annotated Tree AutomataAnders Miltner, Ziteng Wang, Swarat Chaudhuri, Isil DilligCAV 2024 · 2 citations
- Automated Discovery of Tactic Libraries for Interactive Theorem ProvingYutong Xin, Jimmy Xin, Gabriel Poesia, Noah D. Goodman et al.OOPSLA 2025
Builds on7
- Combining the top-down propagation and bottom-up enumeration for inductive program synthesisWoosuk LeePOPL 2021 · 34 citations
- Data-driven inference of representation invariantsAnders Miltner, Saswat Padhi, Todd D. Millstein, David WalkerPLDI 2020 · 33 citations
- Data Migration using Datalog Program SynthesisYuepeng Wang, Rushi Shah, Abby Criswell, Rong Pan et al.VLDB 2020 · 30 citations
- Cyclic program synthesisShachar Itzhaky, Hila Peleg, Nadia Polikarpova, Reuben N. S. Rowe et al.PLDI 2021 · 26 citations
- Synthesis-powered optimization of smart contracts via data type refactoringYanju Chen, Yuepeng Wang, Maruth Goyal, James Dong et al.OOPSLA 2022 · 14 citations
Related papers
- Synthesizing data structure refinements from integrity constraintsShankara Pailoor, Yuepeng Wang, Xinyu Wang, Isil DilligPLDI 2021 · 10 citations
- Synthesizing replacement classesMalavika Samak, Deokhwan Kim, Martin C. RinardPOPL 2020 · 14 citations
- Recursion synthesis with unrealizability witnessesAzadeh Farzan, Danya Lette, Victor NicoletPLDI 2022 · 19 citations
- From Custom Logic to APIs: Understanding and Recommending API Replacement RefactoringsBridget Nyirongo, Yanjie Jiang, Yuxia Zhang, Hui LiuISSTA 2026
- Provenance-guided synthesis of Datalog programsMukund Raghothaman, Jonathan Mendelson, David Zhao, Mayur Naik et al.POPL 2020 · 49 citations
