Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3510003.3510115acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article
Open access

Inferring and applying type changes

Published: 05 July 2022 Publication History

Abstract

Developers frequently change the type of a program element and update all its references to increase performance, security, or maintainability. Manually performing type changes is tedious, error-prone, and it overwhelms developers. Researchers and tool builders have proposed advanced techniques to assist developers when performing type changes. A major obstacle in using these techniques is that the developer has to manually encode rules for defining the type changes. Handcrafting such rules is difficult and often involves multiple trial-error iterations. Given that open-source repositories contain many examples of type-changes, if we could infer the adaptations, we would eliminate the burden on developers. We introduce TC-Infer, a novel technique that infers rewrite rules that capture the required adaptations from the version histories of open source projects. We then use these rules (expressed in the Comby language) as input to existing type change tools. To evaluate the effectiveness of TC-Infer, we use it to infer 4,931 rules for 605 popular type changes in a corpus of 400K commits. Our results show that TC-Infer deduced rewrite rules for 93% of the most popular type change patterns. Our results also show that the rewrite rules produced by TC-Infer are highly effective at applying type changes (99.2% precision and 93.4% recall). To advance the existing tooling we released IntelliTC, an interactive and configurable refactoring plugin for IntelliJ IDEA to perform type changes.

References

[1]
Hussein Alrubaye, Deema AlShoaibi, Mohamed Wiem Mkaouer, and Ali Ouni. 2019. How Does API Migration Impact Software Quality and Comprehension? An Empirical Study. (Jul 2019). https://arxiv.org/abs/1907.07724
[2]
Apache. 2019. Netbeans Refactoring.
[3]
H Atwi, B Lin, N Tsantalis, Y Kashiwa, Y Kamei, N Ubayashi, G Bavota, and M. Lanza. SCAM. PyRef: Refactoring Detection in Python Projects. In SCAM, 2021. https://doi.org/PyRef/PyRef
[4]
Johannes Bader, Andrew Scott, Michael Pradel, and Satish Chandra. 2019. Getafix: Learning to Fix Bugs Automatically. Proc. ACM Program. Lang. 3, OOPSLA, Article 159 (Oct. 2019), 27 pages.
[5]
Ittai Balaban, Frank Tip, and Robert Fuhrer. 2005. Refactoring Support for Class Library Migration. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (San Diego, CA, USA) (OOPSLA '05). ACM, New York, NY, USA, 265--279.
[6]
Joshua Bloch. 2018. Effective Java (3 ed.). Addison-Wesley, Boston, MA. https://www.safaribooksonline.com/library/view/effective-java-third/9780134686097/
[7]
Marat Boshernitsan, Susan L. Graham, Susan L. Graham, and Marti A. Hearst. 2007. Aligning Development Tools with the Way Programmers Think About Code Changes. In Proceedings of the SIGCHI Conference on Human Factors in Computing Systems (San Jose, California, USA) (CHI '07). ACM, New York, NY, USA, 567--576.
[8]
Comby. 2021. Comby Syntax Reference. https://comby.dev/docs/syntax-reference Accessed: 3 Sep 2021.
[9]
Santanu Kumar Dash, Miltiadis Allamanis, and Earl T. Barr. 2018. RefiNym: Using Names to Refine Types. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Lake Buena Vista, FL, USA) (ESEC/FSE 2018). ACM, New York, NY, USA, 107--117.
[10]
Danny Dig, John Marrero, and Michael D. Ernst. 2009. Refactoring Sequential Java Code for Concurrency via Concurrent Libraries. In Proceedings of the 31st International Conference on Software Engineering (ICSE '09). IEEE Computer Society, Washington, DC, USA, 397--407.
[11]
Malinda Dilhara. 2021. Discovering Repetitive Code Changes in ML Systems. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Athens, Greece) (ESEC/FSE 2021). Association for Computing Machinery, New York, NY, USA, 1683--1685.
[12]
Malinda Dilhara, Ameya Ketkar, Nikhith Sannidhi, and Danny Dig. 2022. Discovering Repetitive Code Changes in Python ML Systems. In International Conference on Software Engineering (Pittsburgh, United States) (ICSE '22). ACM/IEEE. To appear.
[13]
Java Platform Documentation. 2019. Autoboxing and unboxing.
[14]
Java Platform Documentation. 2019. StringBuffer.
[15]
Java Platform Documentation. 2019. StringBuilder.
[16]
Eclipse. 2019. Refactoring Actions.
[17]
Jean-Rémy Falleri, Floréal Morandat, Xavier Blanc, Matias Martinez, and Martin Monperrus. 2014. Fine-grained and Accurate Source Code Differencing. In Proceedings of the 29th ACM/IEEE International Conference on Automated Software Engineering (Vasteras, Sweden) (ASE '14). ACM, New York, NY, USA, 313--324.
[18]
S. R. Foster, W. G. Griswold, and S. Lerner. 2012. WitchDoctor: IDE support for real-time auto-completion of refactorings. In 2012 34th International Conference on Software Engineering (ICSE). 222--232.
[19]
Xi Ge, Quinton L. DuBose, and Emerson Murphy-Hill. 2012. Reconciling Manual and Automatic Refactoring. In Proceedings of the 34th International Conference on Software Engineering (Zurich, Switzerland) (ICSE '12). IEEE Press, 211--221.
[20]
Google. 2011. Error Prone. https://github.com/google/error-prone
[21]
Sumit Gulwani. 2011. Automating String Processing in Spreadsheets using Input-Output Examples. In PoPL'11, January 26--28, 2011, Austin, Texas, USA. https://www.microsoft.com/en-us/research/publication/automating-string-processing-spreadsheets-using-input-output-examples/
[22]
Mark Hills, Paul Klint, and Jurgen J. Vinju. 2012. Scripting a Refactoring with Rascal and Eclipse (WRT '12). Association for Computing Machinery, New York, NY, USA, 40--49.
[23]
Abram Hindle, Earl T. Barr, Mark Gabel, Zhendong Su, and Premkumar Devanbu. 2016. On the Naturalness of Software. Commun. ACM 59, 5 (April 2016), 122--131.
[24]
IntelliJ. 2021. IntelliJ Inplace Rename. https://www.jetbrains.com/help/idea/rename-refactorings.html#inplace_rename Accessed: 3 Sep 2021.
[25]
IntelliJ. 2021. IntelliJ Intention Actions. https://www.jetbrains.com/help/idea/intention-actions.html Accessed: 3 Sep 2021.
[26]
IntelliJ. 2021. IntelliJ Java Inspections. https://www.jetbrains.com/help/idea/list-of-java-inspections.html#probable-bugs Accessed: 3 Sep 2021.
[27]
IntelliJ. 2021. IntelliJ: Structural Search and Replace. https://www.jetbrains.com/help/idea/structural-search-and-replace.html Accessed: 3 Sep 2021.
[28]
JetBrains. 2019. Type Migration.
[29]
Suhas Kabinna, Cor-Paul Bezemer, Weiyi Shang, and Ahmed E. Hassan. 2016. Logging Library Migrations: A Case Study for the Apache Software Foundation Projects. In Proceedings of the IEEE/ACM 13th Working Conference on Mining Software Repositories. 154--164.
[30]
Ameya Ketkar, Ali Mesbah, Davood Mazinanian, Danny Dig, and Edward Aftandilian. 2019. Type Migration in Ultra-large-scale Codebases. In Proceedings of the 41st International Conference on Software Engineering (Montreal, Quebec, Canada) (ICSE '19). IEEE Press, Piscataway, NJ, USA, 1142--1153.
[31]
Ameya Ketkar, Nikolaos Tsantalis, and Danny Dig. 2020. Understanding Type Changes in Java. Association for Computing Machinery, New York, NY, USA, 629--641.
[32]
Jongwook Kim, Don Batory, and Danny Dig. 2015. Scripting parametric refactorings in Java to retrofit design patterns. In 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME). 211--220.
[33]
Miryung Kim, David Notkin, Dan Grossman, and Gary Wilson. 2013. Identifying and Summarizing Systematic Code Changes via Rule Inference. IEEE Transactions on Software Engineering 39, 1 (Jan 2013), 45--62.
[34]
H. W. Kuhn. 1955. The Hungarian method for the assignment problem. Naval Research Logistics Quarterly 2, 1--2 (1955), 83--97. arXiv:https://onlinelibrary.wiley.com/doi/pdf/10.1002/nav.3800020109
[35]
Maxime Lamothe, Weiyi Shang, and Tse-Hsun Peter Chen. 2020. A3: Assisting Android API Migrations Using Code Examples. IEEE Transactions on Software Engineering (2020), 1--1.
[36]
Huiqing Li and Simon Thompson. 2012. A Domain-Specific Language for Scripting Refactorings in Erlang. In Fundamental Approaches to Software Engineering, Juan de Lara and Andrea Zisman (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 501--515.
[37]
Jun Li, Chenglong Wang, Yingfei Xiong, and Zhenjiang Hu. 2015. SWIN: Towards Type-Safe Java Program Adaptation Between APIs. In Proceedings of the 2015 Workshop on Partial Evaluation and Program Manipulation (Mumbai, India) (PEPM '15). ACM, New York, NY, USA, 91--102.
[38]
Sifei Luan, Di Yang, Celeste Barnaby, Koushik Sen, and Satish Chandra. 2019. Aroma: Code Recommendation via Structural Code Search. Proc. ACM Program. Lang. 3, OOPSLA, Article 152 (Oct. 2019), 28 pages.
[39]
Na Meng, Miryung Kim, and Kathryn S. Mckinley. [n.d.]. Sydit: Creating and applying a program transformation from an example. In in ESEC/FSE'11, 2011. 440--443.
[40]
Na Meng, Miryung Kim, and Kathryn S. McKinley. 2013. LASE: Locating and Applying Systematic Edits by Learning from Examples. In Proceedings of the 2013 International Conference on Software Engineering (San Francisco, CA, USA) (ICSE '13). IEEE Press, 502--511.
[41]
T. Mens and T. Tourwe. 2001. A declarative evolution framework for object-oriented design patterns. In Proceedings IEEE International Conference on Software Maintenance. ICSM 2001. 570--579.
[42]
Ali Mesbah, Andrew Rice, Emily Johnston, Nick Glorioso, and Edward Aftandilian. 2019. DeepDelta: Learning to Repair Compilation Errors. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering (Tallinn, Estonia) (ESEC/FSE 2019). ACM, New York, NY, USA, 925--936.
[43]
Microsoft. 2021. Visual Studio. (2021). At https://www.visualstudio.com.
[44]
Anders Miltner, Sumit Gulwani, Vu Le, Alan Leung, Arjun Radhakrishna, Gustavo Soares, Ashish Tiwari, and Abhishek Udupa. 2019. On the Fly Synthesis of Edit Suggestions. Proc. ACM Program. Lang. 3, OOPSLA, Article 143 (Oct. 2019), 29 pages.
[45]
H. Nguyen, T. N. Nguyen, D. Dig, S. Nguyen, H. Tran, and M. Hilton. 2019. Graph-Based Mining of In-the-Wild, Fine-Grained, Semantic Code Change Patterns. In 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE). IEEE Computer Society, Los Alamitos, CA, USA, 819--830.
[46]
Hoan Anh Nguyen, Anh Tuan Nguyen, Tung Thanh Nguyen, Tien N. Nguyen, and Hridesh Rajan. 2013. A Study of Repetitiveness of Code Changes in Software Evolution. In Proceedings of the 28th IEEE/ACM International Conference on Automated Software Engineering (Silicon Valley, CA, USA) (ASE'13). IEEE Press, 180--190.
[47]
Hoan Anh Nguyen, Tung Thanh Nguyen, Gary Wilson Jr., Anh Tuan Nguyen, Miryung Kim, and Tien N. Nguyen. 2010. A graph-based approach to API usage adaptation. In Proceedings of the 25th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2010, October 17--21, 2010, Reno/Tahoe, Nevada, USA. 302--321.
[48]
Marius Nita and David Notkin. 2010. Using Twinning to Adapt Programs to Alternative APIs. In Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering - Volume 1 (Cape Town, South Africa) (ICSE '10). ACM, New York, NY, USA, 205--214.
[49]
Baishakhi Ray, Christopher Wiley, and Miryung Kim. 2012. REPERTOIRE: A Cross-System Porting Analysis Tool for Forked Software Projects. In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering (Cary, North Carolina) (FSE '12). Association for Computing Machinery, New York, NY, USA, Article 8, 4 pages.
[50]
Reudismam Rolim, Gustavo Soares, Loris D'Antoni, Oleksandr Polozov, Sumit Gulwani, Rohit Gheyi, Ryo Suzuki, and Björn Hartmann. 2017. Learning Syntactic Program Transformations from Examples. In Proceedings of the 39th International Conference on Software Engineering (Buenos Aires, Argentina) (ICSE '17). IEEE Press, Piscataway, NJ, USA, 404--415.
[51]
Reudismam Rolim, Gustavo Soares, Rohit Gheyi, and Loris D'Antoni. 2018. Learning Quick Fixes from Code Repositories. (2018). http://arxiv.org/abs/1803.03806
[52]
Oleg Smirnov, Ameya Ketkar, Timofey Bryksin, Nikolaos Tsantalis, and Danny Dig. 2021. IntelliTC: Automating Type Changes in IntelliJ IDEA. https://type-change.github.io/index.html Accessed: 10 Feb 2022.
[53]
Oleg Smirnov, Ameya Ketkar, Timofey Bryksin, Nikolaos Tsantalis, and Danny Dig. 2022. IntelliTC: Automating Type Changes in IntelliJ IDEA. In 44th International Conference on Software Engineering Companion (ICSE '22 Companion) (Pittsburgh, United States) (ICSE '22 Companion). ACM/IEEE.
[54]
Friedrich Steimann, Christian Kollee, and Jens von Pilgrim. 2011. A Refactoring Constraint Language and Its Application to Eiffel. In ECOOP 2011 - Object-Oriented Programming, Mira Mezini (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 255--280.
[55]
Cédric Teyton, Jean-Rémy Falleri, Marc Palyart, and Xavier Blanc. 2014. A Study of Library Migrations in Java. J. Softw. Evol. Process 26, 11 (Nov. 2014), 1030--1052.
[56]
Nikolaos Tsantalis, Ameya Ketkar, and Danny Dig. 2020. RefactoringMiner 2.0. IEEE Transactions on Software Engineering (2020), 1--21.
[57]
Rijnard van Tonder and Claire Le Goues. 2019. Lightweight Multi-Language Syntax Transformation with Parser Parser Combinators. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (Phoenix, AZ, USA) (PLDI 2019). Association for Computing Machinery, New York, NY, USA, 363--378.
[58]
Mathieu Verbaere, Arnaud Payement, and Oege de Moor. 2006. Scripting refactorings with JunGL. In Companion to the 21th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2006, October 22--26, 2006, Portland, Oregon, USA, Peri L. Tarr and William R. Cook (Eds.). ACM, 651--652.
[59]
Hyrum K. Wright. 2020. Incremental Type Migration Using Type Algebra. In 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME). 756--765.
[60]
Shengzhe Xu, Ziqi Dong, and Na Meng. 2019. Meditor: Inference and Application of API Migration Edits. In Proceedings of the 27th International Conference on Program Comprehension (Montreal, Quebec, Canada) (ICPC '19). IEEE Press, Piscataway, NJ, USA, 335--346.
[61]
Guangtun Zhu. 2016. A New View of Classification in Astronomy with the Archetype Technique: An Astronomical Case of the NP-complete Set Cover Problem. arXiv:1606.07156 [astro-ph.IM]

Cited By

View all
  • (2024)A Lightweight Polyglot Code Transformation LanguageProceedings of the ACM on Programming Languages10.1145/36564298:PLDI(1288-1312)Online publication date: 20-Jun-2024
  • (2024)Automated Deep Learning Optimization via DSL-Based Source Code TransformationProceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3650212.3652143(479-490)Online publication date: 11-Sep-2024
  • (2024)Unprecedented Code Change Automation: The Fusion of LLMs and Transformation by ExampleProceedings of the ACM on Software Engineering10.1145/36437551:FSE(631-653)Online publication date: 12-Jul-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICSE '22: Proceedings of the 44th International Conference on Software Engineering
May 2022
2508 pages
ISBN:9781450392211
DOI:10.1145/3510003
This work is licensed under a Creative Commons Attribution International 4.0 License.

Sponsors

In-Cooperation

  • IEEE CS

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 05 July 2022

Check for updates

Author Tags

  1. refactoring
  2. source code mining
  3. type change
  4. type migration

Qualifiers

  • Research-article

Funding Sources

  • Industry-University Cooperative Research Center on Pervasive Personalized Intelligence
  • NSERC
  • NSF

Conference

ICSE '22
Sponsor:

Acceptance Rates

Overall Acceptance Rate 276 of 1,856 submissions, 15%

Upcoming Conference

ICSE 2025

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)221
  • Downloads (Last 6 weeks)52
Reflects downloads up to 09 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2024)A Lightweight Polyglot Code Transformation LanguageProceedings of the ACM on Programming Languages10.1145/36564298:PLDI(1288-1312)Online publication date: 20-Jun-2024
  • (2024)Automated Deep Learning Optimization via DSL-Based Source Code TransformationProceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis10.1145/3650212.3652143(479-490)Online publication date: 11-Sep-2024
  • (2024)Unprecedented Code Change Automation: The Fusion of LLMs and Transformation by ExampleProceedings of the ACM on Software Engineering10.1145/36437551:FSE(631-653)Online publication date: 12-Jul-2024
  • (2024)Characterizing Python Library MigrationsProceedings of the ACM on Software Engineering10.1145/36437311:FSE(92-114)Online publication date: 12-Jul-2024
  • (2024)Compiler-directed Migrating API Callsite of Client CodeProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3639084(1-12)Online publication date: 20-May-2024
  • (2024)Migrating Unit Tests Across Java Applications2024 IEEE International Conference on Source Code Analysis and Manipulation (SCAM)10.1109/SCAM63643.2024.00022(131-142)Online publication date: 7-Oct-2024
  • (2023)PyEvolve: Automating Frequent Code Changes in Python ML SystemsProceedings of the 45th International Conference on Software Engineering10.1109/ICSE48619.2023.00091(995-1007)Online publication date: 14-May-2023
  • (2023)Automated Software Entity Matching Between Successive VersionsProceedings of the 38th IEEE/ACM International Conference on Automated Software Engineering10.1109/ASE56229.2023.00132(1615-1627)Online publication date: 11-Nov-2023
  • (2023)MELT: Mining Effective Lightweight Transformations from Pull Requests2023 38th IEEE/ACM International Conference on Automated Software Engineering (ASE)10.1109/ASE56229.2023.00117(1516-1528)Online publication date: 11-Sep-2023
  • (2022)Overwatch: learning patterns in code edit sequencesProceedings of the ACM on Programming Languages10.1145/35633026:OOPSLA2(395-423)Online publication date: 31-Oct-2022
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media