Identifying Versions of Libraries used in Stack Overflow Code Snippets

Stack Overflow is a popular question and answer platform where developers share technical issues in the hope of receiving answers with potential solutions. The latter may include code snippets making use of library versions that have long since been succeeded by newer ones. Other developers finding such a snippet at a later point in time may be unaware of its outdatedness unless mentioned in a comment. Furthermore, it can be difficult to integrate the snippet without knowing the exact version of the library it is referencing. In this paper, we propose an automated approach to identifying ranges of Maven library versions that might have been used in a Java snippet on Stack Overflow. We use a prototype implementation of the approach to assess the overall outdatedness of Stack Overflow snippets with respect to the latest version of each referenced library available from Maven. We found a considerable number of snippets that use outdated library versions, which suggests that developers should be careful when adopting solutions from Stack Overflow.

[1]  Haoxiang Zhang,et al.  Reading Answers on Stack Overflow: Not Enough! , 2021, IEEE Transactions on Software Engineering.

[2]  Shane McIntosh,et al.  Can Duplicate Questions on Stack Overflow Benefit the Software Development Community? , 2019, 2019 IEEE/ACM 16th International Conference on Mining Software Repositories (MSR).

[3]  Apostolos Ampatzoglou,et al.  Reusing Code from StackOverflow: The Effect on Technical Debt , 2019, 2019 45th Euromicro Conference on Software Engineering and Advanced Applications (SEAA).

[4]  Jing Li,et al.  The Qualitas Corpus: A Curated Collection of Java Code for Empirical Studies , 2010, 2010 Asia Pacific Software Engineering Conference.

[5]  Christoph Treude,et al.  SOTorrent: Reconstructing and Analyzing the Evolution of Stack Overflow Posts , 2018, 2018 IEEE/ACM 15th International Conference on Mining Software Repositories (MSR).

[6]  Giuseppe Bianco,et al.  Toxic Code Snippets on Stack Overflow , 2018, IEEE Transactions on Software Engineering.

[7]  Sarah Nadi,et al.  Analyzing Comment-Induced Updates on Stack Overflow , 2019, 2019 IEEE/ACM 16th International Conference on Mining Software Repositories (MSR).

[8]  Andrew Nesbitt,et al.  Libraries.io Open Source Repository and Dependency Metadata , 2017 .

[9]  Alexander Serebrenik,et al.  StackOverflow and GitHub: Associations between Software Development and Crowdsourced Knowledge , 2013, 2013 International Conference on Social Computing.