一句话:首个针对 Java 模块系统强封装被破坏(BSE)问题的实证研究,基于 4,079 个 GitHub issue 刻画其症状、来源与解决方式。
随着软件系统规模达到数亿行代码,仅靠代码级抽象已难以维护,Java 平台模块系统(JPMS)因此提供架构级抽象,让工程师控制模块所需与所提供的接口。然而,尽管 JPMS 强制实施强封装,开发者仍会突破封装以访问模块内部元素,这种行为被称为“破坏强封装”(BSE)。它不仅使向 Java 9 等新版本的迁移复杂化,也威胁软件项目的完整性与安全性,但该问题此前研究不足。本文开展首个实证研究:作者收集了包含 4,079 个 GitHub issue 的综合数据集,并从症状、滥用来源、期望功能与解决方式等多个视角进行分析。研究揭示了 Java 模块系统中的张力——模块开发者希望强制强封装,而模块使用者却频繁试图突破封装,并强调实践者与研究者需制定有效缓解策略,为后续检测与修复工作提供对 BSE 特征的理解。
As an increasing number of software systems reach sizes of hundreds of millions of lines of code, relying solely on code-level abstractions is impractical, posing profound challenges to software maintenance. Java Platform Module System (JPMS) provides architectural abstractions that enable Java engineers to control the required and provided interfaces of a module. Despite numerous advantages of enforced strong encapsulation provided by JPMS, developers still break those encapsulations to access the internal elements of a module. Such practice is referred to as Breaking the Strong Encapsulation (BSE). This behavior not only complicates the migration to newer versions (e.g., Java 9) but also threatens the integrity and safety of software projects. Since the BSE problem is still underexplored, in this work, we conduct the first empirical study to identify and characterize this widespread and impactful problem. We first collect a comprehensive dataset containing 4,079 GitHub issues and then investigate those issues from various perspectives, including symptoms, abuse sources, desired functionalities, and resolutions. Our empirical study highlights a tension in the Java module system: module developers aim to enforce strong encapsulation while module users frequently attempt to break the encapsulation. Our finding also emphasizes the need for both practitioners and researchers to develop effective strategies to mitigate these problems, offering an understanding of BSE characteristics to inform future detection and repair efforts.
@inproceedings{paperbot11936,
title = {Breaking Strong Encapsulation: A Comprehensive Study of Java Module Abuse},
author = {Yirui He and Yongbo Chen and Jessy Ayala and Yecheng Zhou and Qiran Wang and Joshua Garcia},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3764526}
}