Skip to content

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Optimize Java 8 Streams Refactorings

Build Status Coverage Status GitHub license DOI

Introduction

Created with Matplotlib The Java 8 Stream API sets forth a promising new programming model that incorporates functional-like, MapReduce-style features into a mainstream programming language. However, using streams efficiently may involve subtle considerations.

This tool consists of automated refactoring research prototype plug-ins for Eclipse that assists developers in writing optimal stream client code in a semantics-preserving fashion. Refactoring preconditions and transformations for automatically determining when it is safe and possibly advantageous to convert a sequential stream to parallel and improve upon already parallel streams are included. The approach utilizes both WALA and SAFE.

Usage

The refactoring can be run in two different ways:

  1. As a command.
    1. Select a project.
    2. Select "Optimize Streams..." from the "Quick Access" dialog (CTRL-3).
  2. As a menu item.
    1. Right-click on a project.
    2. Under "Refactor," choose "Optimize Streams..."

Currently, the refactoring works only via the package explorer and the outline views. You can either select a single project to optimize or select multiple projects. In each case, the tool will find streams in the enclosing projects to refactor.

Installation

Update Site

An alpha version of our tool is available via an Eclipse update site at: https://raw.githubusercontent.com/ponder-lab/Optimize-Java-8-Streams-Refactoring/master/edu.cuny.hunter.streamrefactoring.updatesite. Please choose the latest version of the "Optimize Stream Refactoring."

Dependencies

The refactoring has several dependencies as listed below. If you experience any trouble installing the plug-in using the above update site, you can manually install the dependencies. The latest version of each plug-in should be installed in the order they are presented:

Dependency Update Site
WALA https://raw.githubusercontent.com/ponder-lab/WALA/master/com.ibm.wala.updatesite
SAFE https://raw.githubusercontent.com/ponder-lab/safe/master/com.ibm.safe.updatesite
Common Eclipse Java Refactoring Framework https://raw.githubusercontent.com/ponder-lab/Common-Eclipse-Java-Refactoring-Framework/master/edu.cuny.citytech.refactoring.common.updatesite

WALA

Please note that there is a special dependency on WALA. Currently, our refactoring requires WALA version 1.3.10. Although this version from the official WALA site would theoretically work, the plug-in has been tested with the WALA version whose update site is listed above. We highly recommend that this version of WALA be used with the plug-in, which may require uninstalling other WALA features from your current Eclipse installation. Issue #192 has been opened to track the future integration.

Marking Entry Points

Explicit entry points may be marked using the appropriate annotation found in the corresponding annotation library. They can also be marked using a text file named entry_points.txt. The processing of this file is recursive; it will search for this file in the same directory as the source code and will traverse up the directory structure until one is found. As such, the file may be placed in, for example, package directories, subproject directories, and project roots. The format of the file is simply a list of method signatures on each line.

Limitations

There are currently some limitations with embedded streams (i.e., streams declared as part of lambda expressions sent as arguments to intermediate stream operations). This is due to model differences between the Eclipse JDT and WALA. See #155 for details.

In general, there is an issue with the mapping between the Eclipse DOM and WALA DOM, particuarly when using Anonymous Inner Classes (AICs). We are currently working with the WALA developers to resolve this issue.

Further Information

See the wiki for further information. For information on contributing, see CONTRIBUTING.md.

About

Refactorings for optimizing Java 8 stream client code for greater parallelism and efficiency.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •