arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2302.08370cs.SE
收藏

第三方 Java 依赖的自动特化

Automatic Specialization of Third-Party Java Dependencies

César Soto-Valero, Deepika Tiwari, Tim Toady, Benoit Baudry

AI总结:

本文提出 DepTrim 工具,基于实际使用自动特化 Java 项目的第三方依赖,移除未用部分,在 30 个开源项目上平均减少 42.2% 的依赖类,显著降低第三方代码占比。

摘要:

大规模代码复用显著降低了开发成本和时间。然而,软件项目中大量的第三方代码带来了新的挑战,尤其是在维护和安全方面。在本文中,我们提出了一种新技术,基于实际使用情况来特化 Java 项目的依赖。给定一个项目及其依赖,我们系统地识别每个依赖中构建项目所必需的子集,并移除其余部分。作为此过程的结果,我们将每个特化的依赖打包到 JAR 文件中。然后,我们生成特化依赖树,其中原始依赖被特化版本替换。这使得构建项目所需的第三方代码比原始版本少得多。因此,特化依赖成为软件供应链中的一等概念,而不是优化编译器工具链中的临时产物。我们将该技术实现于名为 DepTrim 的工具中,并使用 30 个著名的开源 Java 项目对其进行评估。DepTrim 在这些项目中特化了总共 343 个(86.6%)依赖,并成功使用特化依赖树重建了每个项目。此外,通过这种特化,DepTrim 从依赖中移除了总共 57,444 个(42.2%)类,将依赖类与项目类的比率从原始项目中的 8.7 倍降低到特化后的 5.0 倍。这些新颖的结果表明,依赖特化显著减少了 Java 项目中第三方代码的占比。

英文摘要:

Large-scale code reuse significantly reduces both development costs and time. However, the massive share of third-party code in software projects poses new challenges, especially in terms of maintenance and security. In this paper, we propose a novel technique to specialize dependencies of Java projects, based on their actual usage. Given a project and its dependencies, we systematically identify the subset of each dependency that is necessary to build the project, and we remove the rest. As a result of this process, we package each specialized dependency in a JAR file. Then, we generate specialized dependency trees where the original dependencies are replaced by the specialized versions. This allows building the project with significantly less third-party code than the original. As a result, the specialized dependencies become a first-class concept in the software supply chain, rather than a transient artifact in an optimizing compiler toolchain. We implement our technique in a tool called DepTrim, which we evaluate with 30 notable open-source Java projects. DepTrim specializes a total of 343 (86.6%) dependencies across these projects, and successfully rebuilds each project with a specialized dependency tree. Moreover, through this specialization, DepTrim removes a total of 57,444 (42.2%) classes from the dependencies, reducing the ratio of dependency classes to project classes from 8.7x in the original projects to 5.0x after specialization. These novel results indicate that dependency specialization significantly reduces the share of third-party code in Java projects.

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

↑