ponder-lab/Optimize-Java-8-Streams-Refactoring

GitHub: ponder-lab/Optimize-Java-8-Streams-Refactoring

一款 Eclipse 自动化重构插件,通过静态分析安全地将 Java 8 串行 Stream 转换为并行 Stream 并优化其执行效率。

Stars: 8 | Forks: 6

# 优化 Java 8 Streams 重构 [![构建状态](https://app.travis-ci.com/ponder-lab/Optimize-Java-8-Streams-Refactoring.svg?branch=master)](https://travis-ci.com/ponder-lab/Optimize-Java-8-Streams-Refactoring) [![覆盖率状态](https://coveralls.io/repos/github/ponder-lab/Optimize-Java-8-Streams-Refactoring/badge.svg?branch=master)](https://coveralls.io/github/ponder-lab/Optimize-Java-8-Streams-Refactoring?branch=master) [![GitHub license](https://img.shields.io/badge/license-Eclipse-blue.svg)](https://github.com/khatchadourian-lab/Java-8-Stream-Refactoring/raw/master/LICENSE.txt) [![DOI](https://zenodo.org/badge/78147265.svg)](https://zenodo.org/badge/latestdoi/78147265) [![Java profiler](https://www.ej-technologies.com/images/product_banners/jprofiler_small.png)](https://www.ej-technologies.com/products/jprofiler/overview.html) ## 简介 Icon Java 8 Stream API 提出了一种极具前景的新型编程模型,将类函数式的、MapReduce 风格的特性引入到了主流编程语言中。然而,高效地使用 stream 可能需要考虑一些微妙的问题。 此工具包含用于 [Eclipse][eclipse] 的自动化重构研究原型插件,可帮助开发者以保持语义的方式编写最优的 stream 客户端代码。它包含了重构前置条件和转换机制,用于自动确定何时将串行 stream 转换为并行 stream 是安全且可能有益的,并改进现有的并行 stream。该方法同时利用了 [WALA][wala] 和 [SAFE][safe]。 ## 截图 ![Screenshot](http://i2.wp.com/khatchad.commons.gc.cuny.edu/files/2018/03/Screenshot-from-2018-04-28-17-34-53.png) ## 演示 (点击查看) [![重构工具视频演示](http://img.youtube.com/vi/YaSYH7n6y5s/0.jpg)](http://www.youtube.com/watch?v=YaSYH7n6y5s "Optimize Java 8 Stream Refactoring Tool Demonstration") ## 用法 可以通过两种不同的方式运行此重构: 1. 作为命令。 1. 选择一个项目。 2. 从“Quick Access”对话框(CTRL-3)中选择“Optimize Streams...”。 2. 作为菜单项。 1. 右键单击项目。 2. 在“Refactor”下,选择“Optimize Streams...” 目前,该重构仅能通过包资源管理器和结构视图(outline views)进行操作。你可以选择单个项目进行优化,也可以选择多个项目。无论哪种情况,该工具都会在包含的项目中查找要进行重构的 stream。 ## 安装说明 最新版本是 [v0.18.0][v0.18.0]。它已在以下环境中进行了测试:Eclipse IDE for RCP and RAP Developers 版本:2019-03 (4.11.0),Build ID:20190314-1200,运行于 Ubuntu 19.04 上的 OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.19.04.2-b03) 和 OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)。 [此视频][install] 演示了安装此工具的不同方法。 ### 更新站点 我们工具的一个 alpha 版本可以通过 Eclipse 更新站点获取:。请选择最新版本的“Optimize Stream Refactoring”。 ### Eclipse Marketplace 你也可以通过 [Eclipse Marketplace](https://marketplace.eclipse.org/content/optimize-java-8-streams-refactoring) 安装该工具,只需将此图标拖动到你正在运行的 Eclipse 工作区即可:[![拖至正在运行的 Eclipse* 工作区。 *需要 Eclipse Marketplace Client](https://marketplace.eclipse.org/misc/installbutton.png)](http://marketplace.eclipse.org/marketplace-client-intro?mpc_install=4056021 "Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client") ### 依赖项 重构包含以下几个依赖项。如果你在使用上述更新站点安装插件时遇到任何问题,可以手动安装这些依赖项。应当安装最新版本的插件。如果正在安装 SAFE,请注意*必须*先安装 WALA: 依赖项 | 更新站点 --- | --- [WALA](https://github.com/ponder-lab/WALA/tree/streams) | https://raw.githubusercontent.com/ponder-lab/WALA/streams/com.ibm.wala.updatesite [SAFE](https://github.com/tech-srl/safe) | https://raw.githubusercontent.com/tech-srl/safe/master/com.ibm.safe.updatesite [Common Eclipse Java Refactoring Framework](https://github.com/ponder-lab/Common-Eclipse-Java-Refactoring-Framework) | https://raw.githubusercontent.com/ponder-lab/Common-Eclipse-Java-Refactoring-Framework/master/edu.cuny.citytech.refactoring.common.updatesite #### WALA 请注意对 WALA 有一个特殊的依赖。目前,我们的重构需要 **WALA 版本 1.3.10**。尽管从官方 WALA 站点获取的版本在理论上可行,但该插件已使用上面列出的更新站点中的 WALA 版本进行了测试。我们强烈建议将该版本的 WALA 与此插件配合使用,这可能需要从你当前的 Eclipse 安装中卸载其他的 WALA 特性。我们已经创建了 [Issue #192](https://github.com/ponder-lab/Optimize-Java-8-Streams-Refactoring/issues/192) 来跟踪未来的集成情况。 ## 标记入口点 可以使用相应的[注释库][annotations]中找到的适当注释来标记显式入口点。也可以使用名为 `entry_points.txt` 的文本文件来标记它们。对该文件的处理是递归的;它会在与源代码相同的目录中搜索此文件,并向上遍历目录结构,直到找到为止。因此,该文件可以放置在例如包目录、子项目目录和项目根目录中。该文件的格式仅仅是每行一个方法签名列表。 [此视频][entrypoints] 解释了有关如何指定入口点的更多细节。 ## 局限性 目前,对于嵌入式 stream(即作为发送给中间 stream 操作参数的 lambda 表达式的一部分声明的 stream)存在一些限制。这是由于 Eclipse JDT 和 WALA 之间的模型差异造成的。详情请参见 [#155](https://github.com/ponder-lab/Java-8-Stream-Refactoring/issues/155)。 通常,在 Eclipse DOM 和 WALA DOM 之间的映射存在[一个问题](https://github.com/wala/WALA/issues/2/edit81),特别是在使用匿名内部类(AIC)时。我们目前正在与 WALA 的开发者合作解决[此问题](https://github.com/ponder-lab/Java-8-Stream-Refactoring/issues/155)。 ## 工程挑战与解决方案 [此 Wiki 页面][challenges] 着重指出了我们代码中解决我们 [SCAM 2018] [论文] 中概述的若干工程挑战的位置。 ## 更多信息 请参阅 [Wiki][wiki] 获取更多信息。 ## 出版物 Raffi Khatchadourian, Yiming Tang, Mehdi Bagherzadeh, and Syed Ahmed. Safe automated refactoring for intelligent parallelization of Java 8 streams. In International Conference on Software Engineering, ICSE '19, pages 619--630, Piscataway, NJ, USA, May 2019. ACM/IEEE, IEEE Press. [ bib | DOI | slides | http ] Raffi Khatchadourian, Yiming Tang, Mehdi Bagherzadeh, and Syed Ahmed. A tool for optimizing Java 8 stream software via automated refactoring. In International Working Conference on Source Code Analysis and Manipulation, SCAM '18, pages 34--39. IEEE, IEEE Press, September 2018. Engineering Track. [ bib | DOI | slides | http ] ## 引用 要引用此工作,请使用 GitHub 侧边栏中的 **"Cite this repository"** 按钮,该按钮由 [`CITATION.cff`](CITATION.cff) 提供支持,它可以为我们的 [ICSE '19 论文](#Khatchadourian2019) 生成 APA 或 BibTeX 格式的引用。有关相关的 [SCAM '18 工具论文](#Khatchadourian2018b),请参阅上方的[出版物](#publications)。
标签:Eclipse插件, Java开发, JS文件枚举, Nuclei漏洞扫描, 云安全监控, 代码重构, 域名枚举, 并发编程, 性能优化, 检测绕过, 静态分析