A Concern-Centric Empirical Evaluation of Multi-Language Code Smells: An LLM-Assisted Study of JNI Software Evolution
This paper presents a concern-centric empirical evaluation of JNI code smells using LLM-assisted analysis of 8,207 commits across 15 open-source projects, revealing that existing smell definitions cover only 36.5% of developer maintenance concerns and proposing three new smell definitions to address the identified gaps.
Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Modern software often feels like a well-oiled machine, but underneath the sleek interface, it is frequently built from many different parts speaking different languages. To make a program fast, efficient, or capable of talking to specialized hardware, developers often combine code written in one language with code written in another. A common way to do this is through a bridge called the Java Native Interface, which allows a program written in Java to reach out and use powerful tools written in C or C++. While this mix of languages gives software great power, it also creates a unique kind of mess. Just as a translator might struggle to keep two different dialects consistent, the software can develop hidden flaws where the two languages fail to agree on how to share data, manage memory, or handle errors. These flaws, known in the industry as "code smells," are not bugs that crash the program immediately, but rather design choices that make the software difficult to fix, update, or understand over time. For years, experts have tried to catalog these smells, creating lists of what bad cross-language design looks like. But a critical question remained unanswered: do these lists actually match the real problems that developers face every day when they try to keep these complex systems running?
A team of researchers set out to answer this question by looking directly at the history of how software changes over time, rather than just staring at the code itself. They focused on fifteen popular open-source projects that rely heavily on this Java-to-C bridge. Instead of guessing what might be wrong, they examined thousands of updates, or "commits," that developers had made to these projects over the years. They were looking for moments where a developer had to stop and fix a specific maintenance issue related to the connection between the two languages. To handle the sheer volume of data, they used an advanced artificial intelligence tool to read the changes in the code and the notes the developers wrote about them. The AI acted as a highly skilled assistant, scanning through the modifications to identify the specific problem a developer was trying to solve, such as fixing a memory leak, securing a data transfer, or reorganizing how two parts of the system talk to each other. The researchers then manually checked a sample of these findings to ensure the AI was correct, confirming that the method was reliable.
The study uncovered a clear picture of what developers actually struggle with. They identified eleven distinct families of problems that keep coming up. The most common issues involved keeping the boundary between the two languages safe and making sure that resources, like memory or file handles, were properly cleaned up after use. These two categories alone accounted for nearly sixty percent of all the maintenance work the researchers found. This suggests that the most urgent daily work for these developers is simply keeping the connection between the languages from breaking or leaking. However, when the researchers compared these real-world problems against the existing lists of known "code smells," they found a significant gap. The current catalogs, which were largely created by experts based on theoretical design principles, only covered about thirty-six percent of the actual problems developers were fixing. In other words, the existing lists missed the majority of the work developers were doing to keep their software healthy.
The researchers realized that the missing problems were not random errors but recurring patterns that deserved their own names. They found that developers frequently had to make coordinated changes to both the Java code and the C code whenever a single detail changed, a situation that made updates slow and error-prone. They also saw cases where the software was exposing hidden internal details across the language barrier, weakening the security and organization of the system. Finally, they noticed that responsibilities were often placed in the wrong language, forcing one side of the system to constantly ask the other side to do its work, which created unnecessary complexity. Based on these repeated observations, the team proposed three new definitions for code smells that specifically address these cross-language issues. They named them Cross-Language Shotgun Surgery, describing the need to change many files at once; Cross-Language Abstraction Leakage, where hidden details are accidentally exposed; and Wrong Responsibility Allocation, where tasks are assigned to the wrong language layer.
This work shifts the focus from what experts think should be a problem to what developers are actually fixing. By listening to the history of the software itself, the researchers showed that the current understanding of multi-language design flaws is incomplete. The existing lists are good at catching simple, local errors, but they miss the deeper architectural challenges that arise when two different worlds of code try to work together. The new definitions provide a vocabulary for these hidden struggles, offering a way for developers to spot and fix these specific types of messes before they become unmanageable. The study concludes that to truly understand software quality, we must look not just at the static code, but at the long, messy history of how that code is kept alive and evolving.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.