arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2510.20679cs.SE
收藏

Java 去臃肿工具的正确性与精确性基准

A Soundness and Precision Benchmark for Java Debloating Tools

Paderborn University(帕德博恩大学);SAP Labs(SAP实验室);Fraunhofer IEM(弗劳恩霍夫工业工程研究所)

Jonas Klauke, Tom Ohlmer, Stefan Schott, Serena Elisa Ponta, Wolfram Fischer, Eric Bodden

AI总结:

针对 Java 去臃肿工具,构建包含 59 个测试用例的 Deblometer 基准,评估 Deptrim、JShrink 和 ProGuard,发现所有工具均存在移除必要构造导致的不正确性问题,需改进以保障软件可靠性。

摘要:

现代软件开发通过将库作为依赖项导入来重用代码。软件项目平均包含 36 个依赖项,其中 80% 是传递性的,即它们是依赖项的依赖项。近期研究表明,这些依赖项中仅有 24.9% 在运行时是必需的,即使在这些必需的依赖项中,许多程序构造也未被使用,从而向项目中添加了不必要的代码。这促使了去臃肿工具的发展,这些工具移除不必要的依赖项和程序构造,同时通过消除未使用的构造来平衡精确性,并通过保留所有必需的构造来平衡正确性。为了系统地评估这种权衡,我们开发了 Deblometer,一个由 59 个测试用例组成的微基准,旨在评估去臃肿工具对各种 Java 语言特性的支持。每个测试用例都包含一个手动整理的真实基准(ground truth),指定必要的和臃肿的类、方法和字段,从而能够精确测量正确性和精确性。使用 Deblometer,我们评估了三个流行的 Java 去臃肿工具:Deptrim、JShrink 和 ProGuard。我们的评估揭示,所有工具都会移除必要的程序构造,这导致语义改变或执行崩溃。特别是,动态类加载特性在所有被评估的工具中都引入了不正确性。我们的比较表明,Deptrim 保留了更多臃肿的构造,而 ProGuard 移除了更多必要的构造。JShrink 的正确性受到对注解支持有限的显著影响,这导致去臃肿后的工件损坏。这些正确性问题凸显了改进去臃肿工具以确保稳定和可靠的去臃肿软件的必要性。

英文摘要:

Modern software development reuses code by importing libraries as dependencies. Software projects typically include an average of 36 dependencies, with 80% being transitive, meaning they are dependencies of dependencies. Recent research indicates that only 24.9% of these dependencies are required at runtime, and even within those, many program constructs remain unused, adding unnecessary code to the project. This has led to the development of debloating tools that remove unnecessary dependencies and program constructs while balancing precision by eliminating unused constructs and soundness by preserving all required constructs. To systematically evaluate this trade-off, we developed Deblometer, a micro-benchmark consisting of 59 test cases designed to assess support for various Java language features in debloating tools. Each test case includes a manually curated ground truth specifying necessary and bloated classes, methods, and fields, enabling precise measurement of soundness and precision. Using Deblometer, we evaluated three popular Java debloating tools: Deptrim, JShrink, and ProGuard. Our evaluation reveals that all tools remove required program constructs, which results in changed semantics or execution crashes. In particular, the dynamic class loading feature introduces unsoundness in all evaluated tools. Our comparison shows that Deptrim retains more bloated constructs, while ProGuard removes more required constructs. JShrink's soundness is significantly affected by limited support for annotations, which leads to corrupted debloated artifacts. These soundness issues highlight the need to improve debloating tools to ensure stable and reliable debloated software.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑