Skip to main content

Transferring Java Comments Based on Program Static Analysis

  • Conference paper
  • First Online:
  • 2010 Accesses

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 11817))

Abstract

In the process of software development and maintenance, code comments can help developers reduce the time of reading source code, and thus improve their work efficiency. For large Java software projects, comments tend to appear in front of the main program entry or method definition. Readers need to search and read other source files containing the comments, which is very inconvenient. For this purpose, based on program static analysis technique, this paper has realized the process of automatically transferring comments in source code to their corresponding methods’ callers. This method first processes the source code using the program static analysis tool, which identifies the method call and the variable Define-Use and other dependency relations and confirms the comment-transferring paths; then extracts the text information in the comments that are in front of method definitions. Finally, it completes the extraction and transferring of comments in Java projects. The average precision of the experiment with 14 open source Java projects is 82.76%.

The work is supported by National Key R&D Program of China (2018YFB1003901), National Natural Science Foundation of China (61832009, 61728203), 2019 Nanjing University College Student’s Innovation Training Program (X201910284053).

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

References

  1. Moreno, L., Aponte, J., Sridhara, G., et al.: Automatic generation of natural language summaries for Java classes. In: IEEE International Conference on Program Comprehension. IEEE (2013)

    Google Scholar 

  2. Murphy, G.C., Kersten, M., Robillard, M.P., Čubranić, D.: The emergent structure of development tasks. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 33–48. Springer, Heidelberg (2005). https://doi.org/10.1007/11531142_2

    Chapter  Google Scholar 

  3. Wong, E., Liu, T., Tan, L.: Mining existing source code for automatic comment generation. In: IEEE 22nd International Conference on Software Analysis, Evolution and Reengineering (SANER), pp. 380–389. IEEE (2015)

    Google Scholar 

  4. Raychev, V., Vechev, M., Krause, A.: Predicting program properties from “Big Code”. ACM SIGPLAN Not. 50(1), 111–124 (2015)

    Article  Google Scholar 

  5. Kramer, D.: API documentation from source code comments: a case study of Javadoc. In: International Conference on Documentation, SIGDOC 1999, New Orleans, Louisiana, USA, pp. 147–153. DELP, September 1999

    Google Scholar 

  6. Panichella, S., Aponte, J., Penta, M.D., et al.: Mining source code descriptions from developer communications. In: IEEE, International Conference on Program Comprehension, pp. 63–72. IEEE (2012)

    Google Scholar 

  7. Wong, E., Liu, T., Tan, L., et al.: Convolutional neural networks over tree structures for programming language processing. In: Thirtieth AAAI Conference on Artificial Intelligence, pp. 1287–1293. AAAI Press (2016)

    Google Scholar 

  8. Rahman, M.M., Roy, C.K., Kula, R.G.: Predicting usefulness of code review comments using textual features and developer experience. In: IEEE/ACM. MSR (2017)

    Google Scholar 

  9. Sridhara, G., Hill, E., Muppaneni, D., et al.: Towards automatically generating comments for Java methods. IEEE/ACM (2010)

    Google Scholar 

  10. McBurney, P.W., McMillan, C.: An empirical study of the textual similarity between source code and source code summaries. In: 2016 Empirical Software Engineering and Measurement, ESEM 2016, pp. 17–42 (2016)

    Article  Google Scholar 

  11. Haouari, D., Sahraoui, H., Langlais, P.: How good is your comment? A study of comments in Java programs. In: 2011 International Symposium on Empirical Software Engineering and Measurement (ESEM 2011), pp. 137–146 (2011)

    Google Scholar 

  12. Fluri, B., Wursch, M., Gall, H.C.: Do code and comments co-evolve? On the relation between source code and comment changes. In: 14th Working Conference on Reverse Engineering 2007, WCRE 2007, pp. 70–79 (2017)

    Google Scholar 

  13. Chen, H., Liu, Z., Chen, X., et al.: Automatically detecting the scopes of source code comments. In: IEEE Computer Software & Application Conference. IEEE Computer Society (2018)

    Google Scholar 

  14. Zhang, J., Xu, L., Li, Y.: Classifying Python code comments based on supervised learning. In: Meng, X., Li, R., Wang, K., Niu, B., Wang, X., Zhao, G. (eds.) WISA 2018. LNCS, vol. 11242, pp. 39–47. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-02934-0_4

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Lei Xu .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Li, B., Li, F., Huang, X., He, X., Xu, L. (2019). Transferring Java Comments Based on Program Static Analysis. In: Ni, W., Wang, X., Song, W., Li, Y. (eds) Web Information Systems and Applications. WISA 2019. Lecture Notes in Computer Science(), vol 11817. Springer, Cham. https://doi.org/10.1007/978-3-030-30952-7_64

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-30952-7_64

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-30951-0

  • Online ISBN: 978-3-030-30952-7

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics