skip to main content
research-article
Open Access

Synthesizing replacement classes

Published:20 December 2019Publication History
Skip Abstract Section

Abstract

We present a new technique for automatically synthesizing replacement classes. The technique starts with an original class O and a potential replacement class R, then uses R to synthesize a new class that implements the same interface and provides the same functionality as O. Critically, our technique works with a synthe- sized inter-class equivalence predicate between the states of O and R. It uses this predicate to ensure that original and synthesized methods leave corresponding O and R objects in equivalent states. The predicate therefore enables the technique to synthesize individual replacement methods in isolation while still obtain- ing a replacement class that leaves the original and replacement objects in equivalent states after arbitrarily long method invocation sequences. We have implemented the technique as part of a tool, named Mask, and evaluated it using open-source Java classes. The results highlight the effectiveness of Mask in synthesizing replacement classes.

Skip Supplemental Material Section

Supplemental Material

a52-samak.webm

References

  1. Aws Albarghouthi, Isil Dillig, and Arie Gurfinkel. 2016. Maximal Specification Synthesis. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’16). ACM, New York, NY, USA, 789–801. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Glenn Ammons, Rastislav Bodík, and James R. Larus. 2002. Mining Specifications. In Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’02). ACM, New York, NY, USA, 4–16. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Apache Commons 2019. Apache Commons: An Apache project focused on all aspects of reusable Java components. (2019). https://commons.apache.org/Google ScholarGoogle Scholar
  4. API Deprecation 2018. How and When To Deprecate APIs. (2018). https://docs.oracle.com/javase/7/docs/technotes/guides/ javadoc/deprecation/deprecation.htmlGoogle ScholarGoogle Scholar
  5. Daniel W. Barowy, Sumit Gulwani, Ted Hart, and Benjamin Zorn. 2015. FlashRelate: Extracting Relational Data from Semistructured Spreadsheets Using Examples. In Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’15). ACM, New York, NY, USA, 218–228. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Osbert Bastani, Saswat Anand, and Alex Aiken. 2015. Specification Inference Using Context-Free Language Reachability. In Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’15). ACM, New York, NY, USA, 553–566. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Osbert Bastani, Rahul Sharma, Alex Aiken, and Percy Liang. 2018. Active Learning of Points-to Specifications. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2018). ACM, New York, NY, USA, 678–692. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Alvin Cheung, Armando Solar-Lezama, and Samuel Madden. 2013. Optimizing Database-backed Applications with Query Synthesis. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’13). ACM, New York, NY, USA, 3–14. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Danny Dig and Ralph Johnson. 2006. How Do APIs Evolve&Quest; A Story of Refactoring: Research Articles. J. Softw. Maint. Evol. 18, 2 (March 2006), 83–107. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Isil Dillig, Thomas Dillig, Kenneth L. McMillan, and Alex Aiken. 2012. Minimum Satisfying Assignments for SMT. In Computer Aided Verification, P. Madhusudan and Sanjit A. Seshia (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 394–409.Google ScholarGoogle Scholar
  11. Dana Drachsler-Cohen, Sharon Shoham, and Eran Yahav. 2017. Synthesis with Abstract Examples. In Computer Aided Verification, Rupak Majumdar and Viktor Kunčak (Eds.). Springer International Publishing, Cham, 254–278.Google ScholarGoogle Scholar
  12. Dropwizard 2019. Dropwizard. https://github.com/dropwizard/dropwizardGoogle ScholarGoogle Scholar
  13. Eclipse 2019. Eclipse: The Platform for Open Innovation and Collaboration. https://www.eclipse.org/Google ScholarGoogle Scholar
  14. Inc. Eclipse Foundation. 2019. Eclipse Collection: A comprehensive collections library for Java. https://github.com/eclipse/ eclipse-collectionsGoogle ScholarGoogle Scholar
  15. Yu Feng, Ruben Martins, Jacob Van Geffen, Isil Dillig, and Swarat Chaudhuri. 2017a. Component-based Synthesis of Table Consolidation and Transformation Tasks from Examples. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, New York, NY, USA, 422–436. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Yu Feng, Ruben Martins, Yuepeng Wang, Isil Dillig, and Thomas W. Reps. 2017b. Component-based Synthesis for Complex APIs. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2017). ACM, New York, NY, USA, 599–612. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Cormac Flanagan and K. Rustan M. Leino. 2001. Houdini, an Annotation Assistant for ESC/Java. In FME 2001: Formal Methods for Increasing Software Productivity, José Nuno Oliveira and Pamela Zave (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 500–517.Google ScholarGoogle ScholarCross RefCross Ref
  18. Gordon Fraser and Andrea Arcuri. 2011. EvoSuite: Automatic Test Suite Generation for Object-oriented Software. In Proceedings of the 19th ACM SIGSOFT Symposium and the 13th European Conference on Foundations of Software Engineering (ESEC/FSE ’11). ACM, New York, NY, USA, 416–419. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Groovy 2019. Groovy language: A multi-faceted language for the Java platform. http://groovy-lang.org/Google ScholarGoogle Scholar
  20. Guava Collections 2009. Why did Google build Guava collections. (2009). https://code.google.com/archive/p/ google-collections/wikis/Faq.wikiGoogle ScholarGoogle Scholar
  21. Guava v/s Apache 2009. Google Guava vs Apache commons. (2009). https://stackoverflow.com/questions/1444437/ google-guava-vs-apache-commonsGoogle ScholarGoogle Scholar
  22. Samir Hasan, Zachary King, Munawar Hafiz, Mohammed Sayagh, Bram Adams, and Abram Hindle. 2016. Energy Profiles of Java Collections Classes. In Proceedings of the 38th International Conference on Software Engineering (ICSE ’16). ACM, New York, NY, USA, 225–236. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. JDK 2019. Oracle technology network for java developers, oracle technology network, oracle 2019. (2019). https://www. oracle.com/technetwork/java/index.htmlGoogle ScholarGoogle Scholar
  24. JDK Bug fixes 2019. List of bug fixes in JDK 8u221 release. (2019). https://www.oracle.com/technetwork/java/javase/2col/ 8u221-bugfixes-5480117.htmlGoogle ScholarGoogle Scholar
  25. JDK Deprecation 2018. Deprecated JDK elements. (2018). https://docs.oracle.com/javase/7/docs/api/deprecated-list.htmlGoogle ScholarGoogle Scholar
  26. Jinseong Jeon, Xiaokang Qiu, Jeffrey S. Foster, and Armando Solar-Lezama. 2015. JSketch: Sketching for Java. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering (ESEC/FSE 2015). ACM, New York, NY, USA, 934– 937. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Susmit Jha, Sumit Gulwani, Sanjit A. Seshia, and Ashish Tiwari. 2010. Oracle-guided Component-based Program Synthesis. In Proceedings of the 32Nd ACM/IEEE International Conference on Software Engineering - Volume 1 (ICSE ’10). ACM, New York, NY, USA, 215–224. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Puneet Kapur, Brad Cossette, and Robert J. Walker. 2010. Refactoring References for Library Migration. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’10). ACM, New York, NY, USA, 726–738. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Sarfraz Khurshid, Corina S. Păsăreanu, and Willem Visser. 2003. Generalized Symbolic Execution for Model Checking and Testing. In Proceedings of the 9th International Conference on Tools and Algorithms for the Construction and Analysis of Systems (TACAS’03). Springer-Verlag, Berlin, Heidelberg, 553–568. http://dl.acm.org/citation.cfm?id=1765871.1765924Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. James C. King. 1976. Symbolic Execution and Program Testing. Commun. ACM 19, 7 (July 1976), 385–394. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Vasileios Koutavas and Mitchell Wand. 2006a. Bisimulations for Untyped Imperative Objects. In Proceedings of the 15th European Conference on Programming Languages and Systems (ESOP’06). Springer-Verlag, Berlin, Heidelberg, 146–161. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Vasileios Koutavas and Mitchell Wand. 2006b. Small Bisimulations for Reasoning About Higher-order Imperative Programs. In Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’06). ACM, New York, NY, USA, 141–152. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Kubernetes 2019. Kubernetes Client: Java client for the kubernetes API. https://github.com/kubernetes-client/javaGoogle ScholarGoogle Scholar
  34. Shuvendu K. Lahiri, Chris Hawblitzel, Ming Kawaguchi, and Henrique Rebêlo. 2012. SYMDIFF: A Language-Agnostic Semantic Diff Tool for Imperative Programs. In Computer Aided Verification, P. Madhusudan and Sanjit A. Seshia (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 712–717.Google ScholarGoogle Scholar
  35. Benjamin Livshits, Aditya V. Nori, Sriram K. Rajamani, and Anindya Banerjee. 2009. Merlin: Specification Inference for Explicit Information Flow Problems. SIGPLAN Not. 44, 6, 75–86. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Francesco Logozzo. 2004. Automatic Inference of Class Invariants. In Verification, Model Checking, and Abstract Interpretation, Bernhard Steffen and Giorgio Levi (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 211–222.Google ScholarGoogle Scholar
  37. David Mandelin, Lin Xu, Rastislav Bodík, and Doug Kimelman. 2005. Jungloid Mining: Helping to Navigate the API Jungle. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’05). ACM, New York, NY, USA, 48–61. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Jeremy W. Nimmer and Michael D. Ernst. 2002. Automatic Generation of Program Specifications. In Proceedings of the 2002 ACM SIGSOFT International Symposium on Software Testing and Analysis (ISSTA ’02). ACM, New York, NY, USA, 229–239. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Oracle v/s Google 2019. Oracle America, Inc. v. Google, Inc. (2019). https://en.wikipedia.org/wiki/Oracle_America,_Inc._ v._Google,_Inc.Google ScholarGoogle Scholar
  40. Hila Peleg, Sharon Shoham, and Eran Yahav. 2018. Programming Not Only by Example. In Proceedings of the 40th International Conference on Software Engineering (ICSE ’18). ACM, New York, NY, USA, 1114–1124. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Nadia Polikarpova, Ivan Kuraj, and Armando Solar-Lezama. 2016. Program Synthesis from Polymorphic Refinement Types. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). ACM, New York, NY, USA, 522–538. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. PostgreSQL-JDBC-9.3 2019. Email thread on changes in PostgreSQL. (2019). https://www.postgresql.org/message-id/CA %2[email protected]Google ScholarGoogle Scholar
  43. Michael Pradel and Thomas R. Gross. 2009. Automatic Generation of Object Usage Specifications from Large Method Traces. In Proceedings of the 2009 IEEE/ACM International Conference on Automated Software Engineering (ASE ’09). IEEE Computer Society, Washington, DC, USA, 371–382. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. PubNub 2019. Pubnub: Java-based SDKs for Java / Android. https://github.com/pubnub/javaGoogle ScholarGoogle Scholar
  45. Murali Krishna Ramanathan, Ananth Grama, and Suresh Jagannathan. 2007. Static Specification Inference Using Predicate Mining. In Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’07). ACM, New York, NY, USA, 123–134. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. Refaster 2019. Error Prone: A static analysis tool for Java that catches common programming mistakes at compiletime. (2019). https://errorprone.info/Google ScholarGoogle Scholar
  47. ReWrite 2019. ReWrite - Distributed Java Source Refactoring. https://github.com/Netflix-Skunkworks/rewriteGoogle ScholarGoogle Scholar
  48. RxJava 2019. RxJava:Reactive Extensions for the JVM. https://github.com/ReactiveX/RxJavaGoogle ScholarGoogle Scholar
  49. Davide Sangiorgi, Naoki Kobayashi, and Eijiro Sumii. 2011. Environmental Bisimulations for Higher-order Languages. ACM Trans. Program. Lang. Syst. 33, 1, Article 5 (Jan. 2011), 69 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Matthias Schlaipfer, Kaushik Rajan, Akash Lal, and Malavika Samak. 2017. Optimizing Big-Data Queries Using Program Synthesis. In Proceedings of the 26th Symposium on Operating Systems Principles (SOSP ’17). ACM, New York, NY, USA, 631–646. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Rahul Sharma and Alex Aiken. 2014. From Invariant Checking to Invariant Inference Using Randomized Search. In Proceedings of the 16th International Conference on Computer Aided Verification - Volume 8559. Springer-Verlag, Berlin, Heidelberg, 88–105. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Armando Solar-Lezama. 2008. Program Synthesis by Sketching. Ph.D. Dissertation. Berkeley, CA, USA. Advisor(s) Bodik, Rastislav. AAI3353225.Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Armando Solar-Lezama. 2009. The Sketching Approach to Program Synthesis. In Proceedings of the 7th Asian Symposium on Programming Languages and Systems (APLAS ’09). Springer-Verlag, Berlin, Heidelberg, 4–13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Armando Solar-Lezama, Christopher Grant Jones, and Rastislav Bodik. 2008. Sketching Concurrent Data Structures. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’08). ACM, New York, NY, USA, 136–148. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. Armando Solar-Lezama, Liviu Tancau, Rastislav Bodik, Sanjit Seshia, and Vijay Saraswat. 2006. Combinatorial Sketching for Finite Programs. In Proceedings of the 12th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS XII). ACM, New York, NY, USA, 404–415. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Structurizr 2019. Structurizr: Structurizr for Java. https://github.com/structurizr/javaGoogle ScholarGoogle Scholar
  57. Eijiro Sumii and Benjamin C. Pierce. 2004. A Bisimulation for Dynamic Sealing. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’04). ACM, New York, NY, USA, 161–172. Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Eijiro Sumii and Benjamin C. Pierce. 2005. A Bisimulation for Type Abstraction and Recursion. In Proceedings of the 32Nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’05). ACM, New York, NY, USA, 63–74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  59. Mitchell Wand, Ryan Culpepper, Theophilos Giannakopoulos, and Andrew Cobb. 2018. Contextual Equivalence for a Probabilistic Language with Continuous Random Variables and Recursion. Proc. ACM Program. Lang. 2, ICFP, Article 87 (July 2018), 30 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. Chenglong Wang, Alvin Cheung, and Rastislav Bodik. 2017a. Synthesizing Highly Expressive SQL Queries from Inputoutput Examples. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, New York, NY, USA, 452–466. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Yuepeng Wang, Isil Dillig, Shuvendu K. Lahiri, and William R. Cook. 2017b. Verifying Equivalence of Database-driven Applications. Proc. ACM Program. Lang. 2, POPL, Article 56 (Dec. 2017), 29 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. Yuepeng Wang, James Dong, Rushi Shah, and Isil Dillig. 2019. Synthesizing Database Programs for Schema Refactoring. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2019). ACM, New York, NY, USA, 286–300. Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. Tim Wood, Sophia Drossopolou, Shuvendu K. Lahiri, and Susan Eisenbach. 2017. Modular Verification of Procedure Equivalence in the Presence of Memory Allocation. In Programming Languages and Systems, Hongseok Yang (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 937–963.Google ScholarGoogle Scholar
  64. Kuat Yessenov, Ivan Kuraj, and Armando Solar-Lezama. 2017. DemoMatch: API Discovery from Demonstrations. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017). ACM, New York, NY, USA, 64–78. Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. Greta Yorsh, Eran Yahav, and Satish Chandra. 2008. Generating Precise and Concise Procedure Summaries. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’08). ACM, New York, NY, USA, 221–234. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Synthesizing replacement classes

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      • Published in

        cover image Proceedings of the ACM on Programming Languages
        Proceedings of the ACM on Programming Languages  Volume 4, Issue POPL
        January 2020
        1984 pages
        EISSN:2475-1421
        DOI:10.1145/3377388
        Issue’s Table of Contents

        Copyright © 2019 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 20 December 2019
        Published in pacmpl Volume 4, Issue POPL

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!