Advertisement

CMSuggester: Method Change Suggestion to Complement Multi-entity Edits

  • Ye WangEmail author
  • Na Meng
  • Hao Zhong
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11293)

Abstract

Developers spend significant time and effort in maintaining software. In a maintenance task, developers sometimes have to simultaneously modify multiple program entities (i.e., classes, methods, and fields). We refer to such complex changes as multi-entity edits. It is challenging for developers to apply multi-entity edits consistently and completely. Existing tools provide limited support for such edits, mainly because the co-changed entities usually contain diverse program contexts and experience different changes. This paper introduces CMSuggester, an automatic approach that suggests complementary changes for multi-entity edits. Given a multi-entity edit that adds a field and modifies one or more methods to access the field, CMSuggester suggests other methods to co-change for the new field access. CMSuggester is inspired by our previous empirical study, which reveals that the methods co-changed to access a new field usually commonly access the same set of fields declared in the same class. By extracting the fields accessed by the given changed method(s), CMSuggester identifies and recommends any unchanged method that also accesses those fields.

Our evaluation shows that CMSuggester recommends changes for 279 out of 408 suggestion tasks. With the recommended methods, CMSuggester achieves 73% F-score on average, while the widely used tool ROSE achieves 48% F-score. In most cases, as shown in our evaluation results, CMSuggester are useful for developers, since it recommend complete and correct multi-entity edits.

Keywords

Multi-entity edit Common field access Change suggestion 

Notes

Acknowledgment

We thank anonymous reviewers for their valuable comments on our earlier version of the paper. This work was supported by NSF Grant CCF-1565827, National Basic Research Program of China (973 Program) No. 2015CB352203, the National Nature Science Foundation of China No. 61572313, and the grant of Science and Technology Commission of Shanghai Municipality No. 15DZ1100305.

References

  1. 1.
  2. 2.
    Apache Aries (2018). http://aries.apache.org
  3. 3.
    apache/cassandra (2018). https://github.com/apache/cassandra
  4. 4.
    apache/derby (2018). https://github.com/apache/derby
  5. 5.
    apache/mahout (2018). https://github.com/apache/mahout
  6. 6.
    DERBY-2201: Allow scalar functions to return LOBs (2018). https://github.com/apache/derby/commit/638f1b48afc27c094c7f34a6254778c1a4ad9608
  7. 7.
    DERBY-5162: Null out the wrapped Clob when resetting a SQLClob to NULL (2018). https://github.com/apache/derby/commit/e9737b6
  8. 8.
    Fix infinite loop when paging queries with IN (2018). https://github.com/apache/cassandra/commit/7c32ffb
  9. 9.
    MAHOUT-401: Use NamedVector in seq2sparse (2018). https://github.com/apache/mahout/commit/22d7d31
  10. 10.
  11. 11.
    Christa, S., Madhusudhan, V., Suma, V., Rao, J.J.: Software maintenance: from the perspective of effort and cost requirement. In: Satapathy, S., Bhateja, V., Joshi, A. (eds.) Proceedings of the International Conference on Data Engineering and Communication Technology, vol. 469, pp. 759–768. Springer, Singapore (2017).  https://doi.org/10.1007/978-981-10-1678-3_73CrossRefGoogle Scholar
  12. 12.
    Gall, H., Hajek, K., Jazayeri, M.: Detection of logical coupling based on product release history. In: Proceedings of ICSM, pp. 190–198 (1998)Google Scholar
  13. 13.
    Gall, H., Jazayeri, M., Krajewski, J.: CVS release history data for detecting logical couplings. In: Proceedings of IWPSE, pp. 13–23 (2003)Google Scholar
  14. 14.
    Hassan, A.E., Holt, R.C.: Predicting change propagation in software systems. In: Proceedings of ICSM, pp. 284–293 (2004)Google Scholar
  15. 15.
    Herzig, K., Just, S., Zeller, A.: It’s not a bug, it’s a feature: how misclassification impacts bug prediction. In: Proceedings of ICSE, pp. 392–401 (2013)Google Scholar
  16. 16.
    Kim, D., Nam, J., Song, J., Kim, S.: Automatic patch generation learned from human-written patches. In: Proceedings of ICSE, pp. 802–811 (2013)Google Scholar
  17. 17.
    Kim, M., Notkin, D.: Discovering and representing systematic code changes. In: Proceedings of ICSE, pp. 309–319 (2009)Google Scholar
  18. 18.
    Le Goues, C., Nguyen, T., Forrest, S., Weimer, W.: Genprog: a generic method for automatic software repair. IEEE Trans. Softw. Eng. 38(1), 54 (2012)CrossRefGoogle Scholar
  19. 19.
    Li, Z., Zhou, Y.: PR-Miner: automatically extracting implicit programming rules and detecting violations in large software code. In: Proceedings of ESEC/FSE, pp. 306–315 (2005)CrossRefGoogle Scholar
  20. 20.
    Long, F., Amidon, P., Rinard, M.: Automatic inference of code transforms for patch generation. In: Proceedings of ESEC/FSE, pp. 727–739 (2017)Google Scholar
  21. 21.
    Long, F., Rinard, M.: Automatic patch generation by learning correct code. In: Proceedings of POPL, pp. 298–312 (2016)CrossRefGoogle Scholar
  22. 22.
    Meng, N., Kim, M., McKinley, K.: LASE: locating and applying systematic edits. In: Proceedings of ICSE, pp. 502–511 (2013)Google Scholar
  23. 23.
    Nguyen, T.T., Nguyen, H.A., Pham, N.H., Al-Kofahi, J.M., Nguyen, T.N.: Clone-aware configuration management. In: Proceedings of ASE, pp. 123–134 (2009)Google Scholar
  24. 24.
    Park, J., Kim, M., Ray, B., Bae, D.H.: An empirical study of supplementary bug fixes. In: Proceedings of MSR, pp. 40–49 (2012)Google Scholar
  25. 25.
    Rumbaugh, J., Blaha, M., Premerlani, W., Eddy, F., Lorensen, W.: Object-Oriented Modeling and Design. Prentice-Hall Inc., Upper Saddle River (1991)zbMATHGoogle Scholar
  26. 26.
    Shirabad, J.S., Lethbridge, T.C., Matwin, S.: Mining the maintenance history of a legacy software system. In: Proceedings of ICSM, pp. 95–104 (2003)Google Scholar
  27. 27.
    Tan, M.: Online defect prediction for imbalanced data. Master’s thesis, University of Waterloo (2015)Google Scholar
  28. 28.
    Wang, Y., Meng, N., Zhong, H.: An empirical study of multi-entity changes in real bug fixes. In: Proceedings of ICSME (2018)Google Scholar
  29. 29.
    Yin, Z., Yuan, D., Zhou, Y., Pasupathy, S., Bairavasundaram, L.: How do fixes become bugs? In: Proceedings of ESEC/FSE, pp. 26–36 (2011)Google Scholar
  30. 30.
    Ying, A.T.T., Murphy, G.C., Ng, R.T., Chu-Carroll, M.: Predicting source code changes by mining change history. IEEE Trans. Softw. Eng. 30(9), 574–586 (2004)CrossRefGoogle Scholar
  31. 31.
    Zhong, H., Mei, H.: Mining repair model for exception-related bug. J. Syst. Softw. 141, 16–31 (2018)CrossRefGoogle Scholar
  32. 32.
    Zhong, H., Su, Z.: An empirical study on real bug fixes. In: Proceedings of ICSE, pp. 913–923 (2015)Google Scholar
  33. 33.
    Zimmermann, T., Weisgerber, P., Diehl, S., Zeller, A.: Mining version histories to guide software changes. In: Proceedings of ICSE, pp. 563–572 (2004)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  1. 1.Virginia TechBlacksburgUSA
  2. 2.Shanghai Jiao Tong UniversityShanghaiChina

Personalised recommendations