SlideShare a Scribd company logo
Motivation
IMPLICATION & PRECONDITIONS:
• The conversion must be semantics-preserving. That is the behavior of the
program prior to the refactoring must match that of after the refactoring.
• The for loop must iterate over an instance of an Collection.
• The body of the initial for loop must not throw a checked exception.
• The body of the initial for loop must not have more than one reference to a
local, non-effectively final variable defined outside the loop.
• The for loop body must not contain a break or continue statement as these
semantics cannot be expressed via a lambda expression.
ACKNOWLEDGMENT:
• We would like to thank Google Summer of Code, as well as the Eclipse
Foundation, for their funding towards this project.
Eclipse Refactoring Life-Cycle
Examples
Eclipse Refactoring Model:
Abstract:
Java 8 is one of the most significant upgrades to Java programming language and framework. This upgrade provided supports for functional
programming, a new JavaScript engine, a new APIs for date time manipulation, a new streaming API and so on. There are several new key features of
Java 8 that can help make programs easier to read, write, and maintain. Among the new Java 8 features, lambda expressions are touted to be most
significant. Lambda expression simplify the development process by facilitating functional programming. Eclipse is one of the most popular IDEs for
Java. While JDT UI has incorporated several Java 8 quick-fixes and refactoring's, there are still many features left to be done. For example, NetBeans
has a refactoring that converts loops to Lambda expressions. This project is for exploring the porting of such conversion mechanisms in NetBeans to
Eclipse. These may be manifested as refactoring and/or quick-fixes. In this project we are working on the Convert to a lambda expression Java 8
refactoring/quick-fixes. (http://openlab.citytech.cuny.edu/groups/port-netbeans-lambda-refactoring-to-eclipse)
Porting the NetBeans Java 8 Enhanced For Loop Lambda
Expression Refactoring to Eclipse
Md Arefin
Mentor: Raffi Khatchadourian
New York City College of Technology, City University of New York
List<String> list = Arrays.asList({"Moe", "Larry", "Curly"});
//Regular Enhance For Loop Conversion:
for (String s : list) System.out.println(s);
//Suggested Java 8 Lambda expression:
list.forEach(s -> System.out.println(s));
//Better yet:
list.forEach(System.out::println);
//It also should work with streams:
list.stream.forEach(System.out::println);
• The API for refactoring provides a process-level abstraction upon which
specific refactorings may be built.
• Figure 1 shows the elements of this abstraction at a very high level. Here,
arrows between elements represent dependencies
• Once a refactoring has been initiated, an implementer of that
refactoring is used to coordinate condition checking,
gathering details about the refactoring, and ultimately
producing a series of changes that may be applied to the
Eclipse workspace to accomplish the refactoring.
• This implementer must extend the abstract class org.eclipse.
ltk.core.refactoring.Refactoring. The life-cycle for this class
is shown in Figure 2.
JDT Type Hierarchy
References:
[1] Alex Gyori, Lyle Franklin, Danny Dig “Crossing the Gap from Imperative to Functional Programming through
Refactoring” (2013).
[2] Petito, Michael “Eclipse Refactoring”, Clarkson University, EE564 Spring 2007.
• Lambda expression simplify the development process by
facilitating functional programming.
• Lambda expression provide concise way to represent
method interface and also make it easier to iterate
through, filter, and extract data from Collection.
• Due to Java 8 upgrade some programming platform like
tomcat, glassfish, groovy base on java need to be
upgraded. According to Gyori et al. [1], making such
changes manually would require changing approx. 1,700
line of non-commented, non-blank lines of code across
approx. 100 files per project, on average. With our plug-
in, Eclipse developers would not need to make these
changes manually.
FUTURE WORK:
• This is an on-going projects and we will be working on it
throughout the fall semester;
• We also plan to develop refactorings for Java 8 that do not currently
exist in any IDE.
[2]
[2]
[2]

More Related Content

PPT
Loaders complete
PDF
Zen and the Art of REST API documentation - MuCon London 2015
PPTX
Flexible delivery options
PPTX
Virtual Flink Forward 2020: Implement Reliable, Isolated & Unified Job Submis...
PPTX
PDF
Spring Framework Tutorial | VirtualNuggets
PDF
Introduction of A Lightweight Stage-Programming Framework
PPT
Linkers And Loaders
Loaders complete
Zen and the Art of REST API documentation - MuCon London 2015
Flexible delivery options
Virtual Flink Forward 2020: Implement Reliable, Isolated & Unified Job Submis...
Spring Framework Tutorial | VirtualNuggets
Introduction of A Lightweight Stage-Programming Framework
Linkers And Loaders

What's hot (20)

PDF
Cloud Native Serverless Java — Orkhan Gasimov
PDF
Introduction to Functional Programming in Scala
PPTX
COBOL deployment to .Net or JVM - Developer Day
PDF
Introducing Ruby/MVC/RoR
PDF
.NET Core, ASP.NET Core Course, Session 3
PDF
Contributors Guide to the Jakarta EE 10 Galaxy
PPTX
Java Spring Framework
PDF
MuleSoft Surat Virtual Meetup#27 - MuleSoft Runtime 4.4, Transit Gateway and ...
PDF
KnowItPresentation
PDF
Introduction to Spring Framework
PDF
New c sharp3_features_(linq)_part_iv
PDF
Spring Integration: from XML to Java DSL
PDF
Continuous delivery with jenkins pipelines @devopsdays cairo
PDF
Model2Roo - ACME
PDF
Spring Boot: a Quick Introduction
PDF
Multiplatform Apps with Spring, Kotlin, and RSocket
PPTX
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
PPTX
ML model integration with DevOps
PDF
MuleSoft Surat Virtual Meetup#32 - Implementing Command and Query Responsibil...
PDF
Let’s go reactive with JAVA
Cloud Native Serverless Java — Orkhan Gasimov
Introduction to Functional Programming in Scala
COBOL deployment to .Net or JVM - Developer Day
Introducing Ruby/MVC/RoR
.NET Core, ASP.NET Core Course, Session 3
Contributors Guide to the Jakarta EE 10 Galaxy
Java Spring Framework
MuleSoft Surat Virtual Meetup#27 - MuleSoft Runtime 4.4, Transit Gateway and ...
KnowItPresentation
Introduction to Spring Framework
New c sharp3_features_(linq)_part_iv
Spring Integration: from XML to Java DSL
Continuous delivery with jenkins pipelines @devopsdays cairo
Model2Roo - ACME
Spring Boot: a Quick Introduction
Multiplatform Apps with Spring, Kotlin, and RSocket
A-Brief-Introduction-To-JAVA8_By_Srimanta_Sahu
ML model integration with DevOps
MuleSoft Surat Virtual Meetup#32 - Implementing Command and Query Responsibil...
Let’s go reactive with JAVA
Ad

Similar to Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring to Eclipse (20)

PDF
JSR 335 / java 8 - update reference
PDF
Eclipse and Java 8 - Eclipse Day India 2013
PPT
whats new in java 8
PPTX
New Features in JDK 8
PDF
JDT Embraces Lambda Expressions - EclipseCon North America 2014
PPTX
New features in jdk8 iti
KEY
Java Closures
PPT
Java user group 2015 02-09-java8
PPT
Java user group 2015 02-09-java8
DOCX
Colloquium Report
PDF
Refactoring to Java 8 (QCon New York)
PDF
NUS Hackers Club Mar 21 - Whats New in JavaSE 8?
PDF
Java SE 8 & EE 7 Launch
PDF
Java 8 Lambda
PPTX
Lambda Expressions in Java 8
PPTX
The Road to Lambda - Mike Duigou
PPTX
Java 8 - An Overview
PDF
JDT embraces lambda expressions
PDF
PDF
Java 8 selected updates
JSR 335 / java 8 - update reference
Eclipse and Java 8 - Eclipse Day India 2013
whats new in java 8
New Features in JDK 8
JDT Embraces Lambda Expressions - EclipseCon North America 2014
New features in jdk8 iti
Java Closures
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
Colloquium Report
Refactoring to Java 8 (QCon New York)
NUS Hackers Club Mar 21 - Whats New in JavaSE 8?
Java SE 8 & EE 7 Launch
Java 8 Lambda
Lambda Expressions in Java 8
The Road to Lambda - Mike Duigou
Java 8 - An Overview
JDT embraces lambda expressions
Java 8 selected updates
Ad

More from Raffi Khatchadourian (20)

PDF
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
PDF
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
PDF
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
PDF
Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
PDF
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
PDF
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
PDF
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
PPTX
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
PDF
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
PDF
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
PDF
An Empirical Study on the Use and Misuse of Java 8 Streams
PDF
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
PDF
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
PDF
A Brief Introduction to Type Constraints
PDF
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...
PDF
A Tool for Optimizing Java 8 Stream Software via Automated Refactoring
PDF
Towards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
PDF
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
PDF
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
PDF
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
An Empirical Study on the Use and Misuse of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
A Brief Introduction to Type Constraints
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...
A Tool for Optimizing Java 8 Stream Software via Automated Refactoring
Towards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...
Defaultification Refactoring: A Tool for Automatically Converting Java Method...

Recently uploaded (20)

PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
Teaching material agriculture food technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Electronic commerce courselecture one. Pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Programs and apps: productivity, graphics, security and other tools
Teaching material agriculture food technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Building Integrated photovoltaic BIPV_UPV.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25 Week I
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Spectral efficient network and resource selection model in 5G networks
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Per capita expenditure prediction using model stacking based on satellite ima...
Spectroscopy.pptx food analysis technology
Electronic commerce courselecture one. Pdf
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation

Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring to Eclipse

  • 1. Motivation IMPLICATION & PRECONDITIONS: • The conversion must be semantics-preserving. That is the behavior of the program prior to the refactoring must match that of after the refactoring. • The for loop must iterate over an instance of an Collection. • The body of the initial for loop must not throw a checked exception. • The body of the initial for loop must not have more than one reference to a local, non-effectively final variable defined outside the loop. • The for loop body must not contain a break or continue statement as these semantics cannot be expressed via a lambda expression. ACKNOWLEDGMENT: • We would like to thank Google Summer of Code, as well as the Eclipse Foundation, for their funding towards this project. Eclipse Refactoring Life-Cycle Examples Eclipse Refactoring Model: Abstract: Java 8 is one of the most significant upgrades to Java programming language and framework. This upgrade provided supports for functional programming, a new JavaScript engine, a new APIs for date time manipulation, a new streaming API and so on. There are several new key features of Java 8 that can help make programs easier to read, write, and maintain. Among the new Java 8 features, lambda expressions are touted to be most significant. Lambda expression simplify the development process by facilitating functional programming. Eclipse is one of the most popular IDEs for Java. While JDT UI has incorporated several Java 8 quick-fixes and refactoring's, there are still many features left to be done. For example, NetBeans has a refactoring that converts loops to Lambda expressions. This project is for exploring the porting of such conversion mechanisms in NetBeans to Eclipse. These may be manifested as refactoring and/or quick-fixes. In this project we are working on the Convert to a lambda expression Java 8 refactoring/quick-fixes. (http://openlab.citytech.cuny.edu/groups/port-netbeans-lambda-refactoring-to-eclipse) Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring to Eclipse Md Arefin Mentor: Raffi Khatchadourian New York City College of Technology, City University of New York List<String> list = Arrays.asList({"Moe", "Larry", "Curly"}); //Regular Enhance For Loop Conversion: for (String s : list) System.out.println(s); //Suggested Java 8 Lambda expression: list.forEach(s -> System.out.println(s)); //Better yet: list.forEach(System.out::println); //It also should work with streams: list.stream.forEach(System.out::println); • The API for refactoring provides a process-level abstraction upon which specific refactorings may be built. • Figure 1 shows the elements of this abstraction at a very high level. Here, arrows between elements represent dependencies • Once a refactoring has been initiated, an implementer of that refactoring is used to coordinate condition checking, gathering details about the refactoring, and ultimately producing a series of changes that may be applied to the Eclipse workspace to accomplish the refactoring. • This implementer must extend the abstract class org.eclipse. ltk.core.refactoring.Refactoring. The life-cycle for this class is shown in Figure 2. JDT Type Hierarchy References: [1] Alex Gyori, Lyle Franklin, Danny Dig “Crossing the Gap from Imperative to Functional Programming through Refactoring” (2013). [2] Petito, Michael “Eclipse Refactoring”, Clarkson University, EE564 Spring 2007. • Lambda expression simplify the development process by facilitating functional programming. • Lambda expression provide concise way to represent method interface and also make it easier to iterate through, filter, and extract data from Collection. • Due to Java 8 upgrade some programming platform like tomcat, glassfish, groovy base on java need to be upgraded. According to Gyori et al. [1], making such changes manually would require changing approx. 1,700 line of non-commented, non-blank lines of code across approx. 100 files per project, on average. With our plug- in, Eclipse developers would not need to make these changes manually. FUTURE WORK: • This is an on-going projects and we will be working on it throughout the fall semester; • We also plan to develop refactorings for Java 8 that do not currently exist in any IDE. [2] [2] [2]