An Empirical Study of Java Code Improvements Based on Stack Overflow Answer Edits
- URL: http://arxiv.org/abs/2511.05813v1
- Date: Sat, 08 Nov 2025 03:01:55 GMT
- Title: An Empirical Study of Java Code Improvements Based on Stack Overflow Answer Edits
- Authors: In-on Wiratsin, Chaiyong Ragkhitwetsagul, Matheus Paixao, Denis De Sousa, Pongpop Lapvikai, Peter Haddawy,
- Abstract summary: Suboptimal code is prevalent in software systems.<n>Developers often write low-quality code due to factors like technical knowledge gaps, insufficient experience, time pressure, management decisions, or personal factors.<n>We present an empirical study of SO Java answer edits and their application to improving code in open-source projects.
- Score: 0.22166578153935793
- License: http://creativecommons.org/licenses/by-sa/4.0/
- Abstract: Suboptimal code is prevalent in software systems. Developers often write low-quality code due to factors like technical knowledge gaps, insufficient experience, time pressure, management decisions, or personal factors. Once integrated, the accumulation of this suboptimal code leads to significant maintenance costs and technical debt. Developers frequently consult external knowledge bases, such as API documentation and Q&A websites like Stack Overflow (SO), to aid their programming tasks. SO's crowdsourced, collaborative nature has created a vast repository of programming knowledge. Its community-curated content is constantly evolving, with new answers posted or existing ones edited. In this paper, we present an empirical study of SO Java answer edits and their application to improving code in open-source projects. We use a modified code clone search tool to analyze SO code snippets with version history and apply it to open-source Java projects. This identifies outdated or unoptimized code and suggests improved alternatives. Analyzing 140,840 Java accepted answers from SOTorrent and 10,668 GitHub Java projects, we manually categorized SO answer edits and created pull requests to open-source projects with the suggested code improvements. Our results show that 6.91% of SO Java accepted answers have more than one revision (average of 2.82). Moreover, 49.24% of the code snippets in the answer edits are applicable to open-source projects, and 11 out of 36 proposed bug fixes based on these edits were accepted by the GitHub project maintainers.
Related papers
- Adoption and Evolution of Code Style and Best Programming Practices in Open-Source Projects [2.9439848714137447]
This paper analyzes 1,036 popular open-source JAVA projects on GITHUB to study how code style and programming practices are adopted and evolve over time.<n>We found widespread violations across repositories, with Javadoc and Naming violations being the most common.<n>We also found a significant number of violations of the GOOGLE Java Style Guide in categories often missed by modern static analysis tools.
arXiv Detail & Related papers (2026-01-14T19:48:47Z) - Does Editing Improve Answer Quality on Stack Overflow? A Data-Driven Investigation [5.176434782905268]
Poor-quality answers in technical Q&A platforms like Stack Overflow introduce inefficiencies, bugs, and security vulnerabilities.<n>To improve content quality, SO allows collaborative editing, where users revise answers to enhance clarity, correctness, and formatting.<n>We analyze 94,994 Python-related answers that have at least one accepted edit to determine whether edits improve semantic relevance, code usability, (3) code complexity, (4) security vulnerabilities, (5) code optimization, and (6) readability.
arXiv Detail & Related papers (2025-07-28T20:51:55Z) - SwingArena: Competitive Programming Arena for Long-context GitHub Issue Solving [90.32201622392137]
We present SwingArena, a competitive evaluation framework for Large Language Models (LLMs)<n>Unlike traditional static benchmarks, SwingArena models the collaborative process of software by pairing LLMs as iterations, who generate patches, and reviewers, who create test cases and verify the patches through continuous integration (CI) pipelines.
arXiv Detail & Related papers (2025-05-29T18:28:02Z) - GBM Returns the Best Prediction Performance among Regression Approaches: A Case Study of Stack Overflow Code Quality [2.5515299924109858]
We examined the variables that predict Stack Overflow (Java) code quality, and the regression approach that provides the best predictive power.<n>Longer Stack Overflow code tended to have more code violations, questions that were scored higher also attracted more views and the more answers that are added to questions on Stack Overflow the more errors were typically observed in the code that was provided.
arXiv Detail & Related papers (2025-05-15T07:04:17Z) - Understanding Code Understandability Improvements in Code Reviews [79.16476505761582]
We analyzed 2,401 code review comments from Java open-source projects on GitHub.
83.9% of suggestions for improvement were accepted and integrated, with fewer than 1% later reverted.
arXiv Detail & Related papers (2024-10-29T12:21:23Z) - Towards Better Answers: Automated Stack Overflow Post Updating [11.85319691188159]
We introduce a novel framework, named Soup (Stack Overflow Updator for Post) for this task.
Soup addresses two key tasks: Valid Comment-Edit Prediction (VCP) and Automatic Post Updating (APU)
arXiv Detail & Related papers (2024-08-17T04:48:53Z) - CodeRAG-Bench: Can Retrieval Augment Code Generation? [78.37076502395699]
We conduct a systematic, large-scale analysis of code generation using retrieval-augmented generation.<n>We first curate a comprehensive evaluation benchmark, CodeRAG-Bench, encompassing three categories of code generation tasks.<n>We examine top-performing models on CodeRAG-Bench by providing contexts retrieved from one or multiple sources.
arXiv Detail & Related papers (2024-06-20T16:59:52Z) - Long Code Arena: a Set of Benchmarks for Long-Context Code Models [75.70507534322336]
Long Code Arena is a suite of six benchmarks for code processing tasks that require project-wide context.
These tasks cover different aspects of code processing: library-based code generation, CI builds repair, project-level code completion, commit message generation, bug localization, and module summarization.
For each task, we provide a manually verified dataset for testing, an evaluation suite, and open-source baseline solutions.
arXiv Detail & Related papers (2024-06-17T14:58:29Z) - How Do Java Developers Reuse StackOverflow Answers in Their GitHub Projects? [5.064338135936606]
StackOverflow (SO) is a widely used question-and-answer (Q&A) website for software developers and computer scientists.
GitHub is an online development platform used for storing, tracking, and collaborating on software projects.
We did an empirical study by mining the SO answers reused by Java projects available on GitHub.
arXiv Detail & Related papers (2023-08-18T14:04:59Z) - Coeditor: Leveraging Contextual Changes for Multi-round Code Auto-editing [57.776971051512234]
In this work, we explore a multi-round code auto-editing setting, aiming to predict edits to a code region based on recent changes within the same.
Our model, Coeditor, is a fine-tuned language model specifically designed for code editing tasks.
In a simplified single-round, single-edit task, Coeditor significantly outperforms GPT-3.5 and SOTA open-source code completion models.
arXiv Detail & Related papers (2023-05-29T19:57:36Z) - RepoCoder: Repository-Level Code Completion Through Iterative Retrieval
and Generation [96.75695811963242]
RepoCoder is a framework to streamline the repository-level code completion process.
It incorporates a similarity-based retriever and a pre-trained code language model.
It consistently outperforms the vanilla retrieval-augmented code completion approach.
arXiv Detail & Related papers (2023-03-22T13:54:46Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.