SlideShare a Scribd company logo
Automated Refactoring of Legacy
Java Software to Default Methods
Raffi Khatchadourian1
Hidehiko Masuhara2
1
Hunter College & the Graduate Center, City University of New York
2
Tokyo Institute of Technology
Introduction
Java 8 introduces enhanced interfaces, allowing for
default (instance) methods that implementers will in-
herit if none are provided [3]. Default methods can
be used [2] as a replacement of the skeletal imple-
mentation pattern [1], which creates abstract skeletal
implementation classes that implementers extend.
Migrating legacy code using the skeletal implementa-
tion pattern to instead use default methods can re-
quire significant manual effort due to subtle language
and semantic restrictions. It requires preserving type-
correctness by analyzing complex type hierarchies, re-
solving issues arising from multiple inheritance, recon-
ciling differences between class and interface methods,
and ensuring tie-breakers with overriding class methods
do not alter semantics.
We propose an efficient, fully-automated, semantics-
preserving refactoring approach, based on type con-
straints [4,5] and implemented as an open source
Eclipse plug-in, that assists developers in taking ad-
vantage of enhanced interfaces. It identifies instances
of the pattern and safely migrates class method imple-
mentations to interfaces as default methods.
Motivating Example
Consider the following interface:
1 interface Collection<E> {
2 int size();
3 void setSize(int i) throws Exception;
4 void add(E elem); // optional.
5 void removeLast();
6 boolean isEmpty();
7 int capacity();}
And the following skeletal implementation classes:
1 abstract class AbstractCollection<E> implements Collection<E>,
2 Object[] elems; int size; // instance fields.
3 @Override public int size() {return this.size;}
4 @Override public void setSize(int i) {this.size = i;}
5 @Override public void add(E elem)
6 {throw new UnsupportedOperationException();}}
7 @Override public void removeLast()
8 {if (!isEmpty()) this.setSize(this.size()-1);}
9 @Override public boolean isEmpty() {return this.size()==0;}
10 @Override public int capacity() {return this.elems.length;}}
Implementers now extend AbstractCollection to inherit
the skeletal implementations of Collection:
1 // inherits skeletal implementations:
2 List<String> list = new AbstractList<>() {};
And override its methods as needed:
1 List<string> immutableList = new AbstractList<> {
2 @Override public void add(E elem) {
3 throw new UnsupportedOperationException();}}
This pattern has several drawbacks, including:
Inheritance. Implementers extending
AbstractCollection cannot further extend.
Modularity. No syntactic path between Collection and
AbstractCollection.
Bloated libraries. Skeletal implementation classes
must be separate from interfaces.
Refactoring Approach
Can we refactor abstract skeletal implementation
classes to instead utilize default methods?
Type Constraints
[E] the type of expression or declaration element E.
[M] the declared return type of method M.
Decl(M) the type that contains method M.
Param(M, i) the i-th formal parameter of method M.
T ≤ T T is equal to T, or T is a subtype of T.
Figure 1: Type constraint notation (inspired by [5]).
We use type constraints [4,5] to express refactoring
preconditions. For each program element, type con-
straints denote the subtyping relationships that must
hold between corresponding expressions for that por-
tion of the system to be considered well-typed. Thus,
a complete program is type-correct if all constraints
implied by all program elements hold. Fig. 2 depicts
several constraints used.
program construct implied type constraint(s)
method call
E.m(E1, . . . , En)
to a virtual method M
(throwing exceptions
Ext1, . . . , Extj)
[E.m(E1, . . . , En)] [M] (1)
[Ei] ≤ [Param(M, i)] (2)
[E] ≤ Decl(M1) ∨ · · · ∨
[E] ≤ Decl(Mk) (3)
where RootDefs(M) =
{M1, . . . , Mk}
∀Ext ∈ {Ext1, . . . , Extj} (4)
∃Exh ∈ Handle(E.m(E1, . . . , En))
[[Ext] ≤ [Exh]]
access E.f to field F
[E.f] [F] (5)
[E] ≤ Decl(F) (6)
Figure 2: Example type constraints.
Inferring Type Constraints
Type constraints are used to determine if a possible
migration will either result in a type-incorrect or se-
mantically different program. For example:
• Migrating size() and capacity() from
AbstractCollection to Collection implies that
[this] = Collection, violating constraint (6) that
[this] ≤ [AbstractCollection].
• Migrating AbstractCollection.setSize() to
Collection implies that the method now throws
an Exception, violating constraint (4) as
Handle(this.setSize(this.size()-1)) = ∅.
• add(), removeLast(), and isEmpty() from
AbstractCollection can be safely migrated to
Collection as a default method (Lst. 1) since
there are no type constraint violations.
1 interface Collection<E> {
2 int size();
3 void setSize(int i) throws Exception;
4 default void add(E elem) // optional.
5 {throw new UnsupportedOperationException();}
6 default void removeLast()
7 {if (!isEmpty()) this.setSize(this.size()-1);}
8 default boolean isEmpty() {return this.size()==0;}
9 int capacity();
10 abstract class AbstractCollection<E> implements Collection<E> {
11 Object[] elems; int size; // instance fields.
12 @Override public int size() {return this.size;}
13 @Override public void setSize(int i) {this.size = i;}
14 @Override public void add(E elem)
15 {throw new UnsupportedOperationException();}}
16 @Override public void removeLast()
17 {if (!isEmpty()) this.setSize(this.size()-1);}
18 @Override public boolean isEmpty(){return this.size()==0;}
19 @Override public int capacity() {return this.elems.length;}
1: Refactored version.
Evaluation
subject KL KM cnds dflts fps δ -δ tm (s)
ArtOfIllusion 118 6.94 16 1 34 1 0 3.65
Azureus 599 3.98 747 116 1366 31 2 61.83
Colt 36 3.77 69 4 140 3 0 6.76
elasticsearch 585 47.87 339 69 644 21 4 83.30
Java8 291 30.99 299 93 775 25 10 64.66
JavaPush 6 0.77 1 0 4 0 0 1.02
JGraph 13 1.47 16 2 21 1 0 3.12
JHotDraw 32 3.60 181 46 282 8 0 7.75
JUnit 26 3.58 9 0 25 0 0 0.79
MWDumper 5 0.40 11 0 24 0 0 0.29
osgi 18 1.81 13 3 11 2 0 0.76
rdp4j 2 0.26 10 8 2 1 0 1.10
spring 506 53.51 776 150 1459 50 13 91.68
Tomcat 176 16.15 233 31 399 13 0 13.81
verbose 4 0.55 1 0 1 0 0 0.55
VietPad 11 0.58 15 0 26 0 0 0.36
Violet 27 2.06 104 40 102 5 1 3.54
Wezzle2D 35 2.18 87 13 181 5 0 4.26
ZKoss 185 15.95 394 76 684 0 0 33.95
Totals: 2677 232.2 3321 652 6180 166 30 383.17
Table 1: Experimental results.
Able to automatically migrate 19.63% (column dflts)
of candidate methods despite of its conservatism.
Figure 3: Precondition failures
Preliminary Pull Request Study
Submitted 19 pull requests to Java projects on GitHub,
of which 4 have been successfully merged, 5 are
open, and 10 were closed without merging. Merged
projects totaled 163 watches, 1071 stars, and 180
forks. Projects rejecting requests citing reasons such
as that they needed to support older Java clients.
Conclusion
We have presented an efficient, fully-automated, type
constraint-based, semantics-preserving approach, fea-
turing an exhaustive rule set, that migrates the skeletal
implementation pattern in legacy Java code to instead
use default methods. It is implemented as an Eclipse
IDE plug-in and was evaluated on 19 open source
projects. The results show that our tool scales and
was able to refactor, despite its conservativeness and
language constraints, 19.63% of all methods possibly
participating in the pattern with minimal intervention.
Our study highlights pattern usage and gives insight to
language designers on applicability to existing software.
References
[1] Joshua Bloch. Effective Java. Prentice Hall, 2008.
[2] Brian Goetz. Interface evolution via virtual extensions methods. Tech-
nical report, Oracle Corporation, June 2011.
[3] Oracle Corporation. Java Programming Language Enhancements.
[4] Jens Palsberg and Michael I. Schwartzbach. Object-oriented type sys-
tems. John Wiley and Sons Ltd., 1994.
[5] Frank Tip, Robert M. Fuhrer, Adam Kieżun, Michael D. Ernst, Ittai Bal-
aban, and Bjorn De Sutter. Refactoring using type constraints. ACM
TOPLAS, 33(3):9:1–9:47, May 2011.
International Conference on Software Engineering, May 20–28, 2017, Buenos Aires, Argentina

More Related Content

What's hot

Java interfaces
Java interfacesJava interfaces
Java interfaces
Raja Sekhar
 
Interface java
Interface java Interface java
Interface java
atiafyrose
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
jehan1987
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
Abishek Purushothaman
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
Elizabeth alexander
 
Interface
InterfaceInterface
Interface
kamal kotecha
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
New York City College of Technology Computer Systems Technology Colloquium
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
Shreyans Pathak
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
VINOTH R
 
Interface in java
Interface in javaInterface in java
Interface in java
Kavitha713564
 
Interfaces in JAVA !! why??
Interfaces in JAVA !!  why??Interfaces in JAVA !!  why??
Interfaces in JAVA !! why??
vedprakashrai
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces Tuan Ngo
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
Kavitha713564
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
dheeraj_cse
 
Java interface
Java interfaceJava interface
Java interface
Arati Gadgil
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Javaparag
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritanceArjun Shanka
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;s
vivek p s
 

What's hot (20)

Java interface
Java interfaceJava interface
Java interface
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Interface java
Interface java Interface java
Interface java
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Java interfaces
Java   interfacesJava   interfaces
Java interfaces
 
Interface
InterfaceInterface
Interface
 
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...Towards Improving Interface Modularity in Legacy Java Software Through Automa...
Towards Improving Interface Modularity in Legacy Java Software Through Automa...
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Interfaces in JAVA !! why??
Interfaces in JAVA !!  why??Interfaces in JAVA !!  why??
Interfaces in JAVA !! why??
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces
 
Methods in Java
Methods in JavaMethods in Java
Methods in Java
 
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar SinghInterface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
 
Java interface
Java interfaceJava interface
Java interface
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Java
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritance
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;s
 

Similar to Poster on Automated Refactoring of Legacy Java Software to Default Methods

Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Raffi Khatchadourian
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
Raffi Khatchadourian
 
Methods
MethodsMethods
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
Docent Education
 
A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X Transformation
Coen De Roover
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
Mohammad Faizan
 
Transfer Learning for Improving Model Predictions in Highly Configurable Soft...
Transfer Learning for Improving Model Predictions in Highly Configurable Soft...Transfer Learning for Improving Model Predictions in Highly Configurable Soft...
Transfer Learning for Improving Model Predictions in Highly Configurable Soft...
Pooyan Jamshidi
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
HongAnhNguyn285885
 
Design patterns
Design patternsDesign patterns
Design patterns
Anas Alpure
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2
Savio Sebastian
 
Symbolic Execution And KLEE
Symbolic Execution And KLEESymbolic Execution And KLEE
Symbolic Execution And KLEE
Shauvik Roy Choudhary, Ph.D.
 
Java 7: Quo vadis?
Java 7: Quo vadis?Java 7: Quo vadis?
Java 7: Quo vadis?
Michal Malohlava
 
1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers
Akash Gawali
 
21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)
ssuser7f90ae
 
MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...
MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...
MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...
ijcsa
 
PATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design PatternsPATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design Patterns
Michael Heron
 
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
NECST Lab @ Politecnico di Milano
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8

Similar to Poster on Automated Refactoring of Legacy Java Software to Default Methods (20)

Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
Open Problems in Automatically Refactoring Legacy Java Software to use New Fe...
 
Automatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to InterfacesAutomatic Migration of Legacy Java Method Implementations to Interfaces
Automatic Migration of Legacy Java Method Implementations to Interfaces
 
Methods
MethodsMethods
Methods
 
14 operator overloading
14 operator overloading14 operator overloading
14 operator overloading
 
A Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X TransformationA Recommender System for Refining Ekeko/X Transformation
A Recommender System for Refining Ekeko/X Transformation
 
Colloquium Report
Colloquium ReportColloquium Report
Colloquium Report
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Transfer Learning for Improving Model Predictions in Highly Configurable Soft...
Transfer Learning for Improving Model Predictions in Highly Configurable Soft...Transfer Learning for Improving Model Predictions in Highly Configurable Soft...
Transfer Learning for Improving Model Predictions in Highly Configurable Soft...
 
00_Introduction to Java.ppt
00_Introduction to Java.ppt00_Introduction to Java.ppt
00_Introduction to Java.ppt
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2
 
Symbolic Execution And KLEE
Symbolic Execution And KLEESymbolic Execution And KLEE
Symbolic Execution And KLEE
 
Java 7: Quo vadis?
Java 7: Quo vadis?Java 7: Quo vadis?
Java 7: Quo vadis?
 
final
finalfinal
final
 
1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers1183 c-interview-questions-and-answers
1183 c-interview-questions-and-answers
 
21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)21UCAC31 Java Programming.pdf(MTNC)(BCA)
21UCAC31 Java Programming.pdf(MTNC)(BCA)
 
MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...
MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...
MULTIPROCESSOR SCHEDULING AND PERFORMANCE EVALUATION USING ELITIST NON DOMINA...
 
PATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design PatternsPATTERNS04 - Structural Design Patterns
PATTERNS04 - Structural Design Patterns
 
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
A Highly Parallel Semi-Dataflow FPGA Architecture for Large-Scale N-Body Simu...
 
Introduction to new features in java 8
Introduction to new features in java 8Introduction to new features in java 8
Introduction to new features in java 8
 

More from Raffi Khatchadourian

Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
Raffi Khatchadourian
 
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Raffi Khatchadourian
 
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
Raffi Khatchadourian
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Raffi Khatchadourian
 
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
Raffi Khatchadourian
 
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
Raffi Khatchadourian
 
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Raffi Khatchadourian
 
An Empirical Study on the Use and Misuse of Java 8 Streams
An Empirical Study on the Use and Misuse of Java 8 StreamsAn Empirical Study on the Use and Misuse of Java 8 Streams
An Empirical Study on the Use and Misuse of Java 8 Streams
Raffi Khatchadourian
 
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 StreamsSafe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Raffi Khatchadourian
 
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 StreamsSafe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Raffi Khatchadourian
 
A Brief Introduction to Type Constraints
A Brief Introduction to Type ConstraintsA Brief Introduction to Type Constraints
A Brief Introduction to Type Constraints
Raffi Khatchadourian
 
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...
Raffi Khatchadourian
 
A Tool for Optimizing Java 8 Stream Software via Automated Refactoring
A Tool for Optimizing Java 8 Stream Software via Automated RefactoringA Tool for Optimizing Java 8 Stream Software via Automated Refactoring
A Tool for Optimizing Java 8 Stream Software via Automated Refactoring
Raffi Khatchadourian
 
Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...
Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...
Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...
Raffi Khatchadourian
 
Towards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
Towards Safe Refactoring for Intelligent Parallelization of Java 8 StreamsTowards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
Towards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
Raffi Khatchadourian
 
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Proactive Empirical Assessment of New Language Feature Adoption via Automated...Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Raffi Khatchadourian
 
Detecting Broken Pointcuts using Structural Commonality and Degree of Interest
Detecting Broken Pointcuts using Structural Commonality and Degree of InterestDetecting Broken Pointcuts using Structural Commonality and Degree of Interest
Detecting Broken Pointcuts using Structural Commonality and Degree of Interest
Raffi Khatchadourian
 
Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...
Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...
Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...
Raffi Khatchadourian
 
Fraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
Fraglight: Shedding Light on Broken Pointcuts Using Structural CommonalityFraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
Fraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
Raffi Khatchadourian
 
Objective-C for Java Developers, Lesson 1
Objective-C for Java Developers, Lesson 1Objective-C for Java Developers, Lesson 1
Objective-C for Java Developers, Lesson 1
Raffi Khatchadourian
 

More from Raffi Khatchadourian (20)

Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
Towards Safe Automated Refactoring of Imperative Deep Learning Programs to Gr...
 
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
 
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
A Tool for Rejuvenating Feature Logging Levels via Git Histories and Degree o...
 
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
Challenges in Migrating Imperative Deep Learning Programs to Graph Execution:...
 
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
Actor Concurrency Bugs: A Comprehensive Study on Symptoms, Root Causes, API U...
 
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
An Empirical Study of Refactorings and Technical Debt in Machine Learning Sys...
 
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
Automated Evolution of Feature Logging Statement Levels Using Git Histories a...
 
An Empirical Study on the Use and Misuse of Java 8 Streams
An Empirical Study on the Use and Misuse of Java 8 StreamsAn Empirical Study on the Use and Misuse of Java 8 Streams
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 StreamsSafe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
 
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams
Safe Automated Refactoring for Intelligent Parallelization of Java 8 StreamsSafe 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
A Brief Introduction to Type ConstraintsA Brief Introduction to Type Constraints
A Brief Introduction to Type Constraints
 
Safe Automated Refactoring for Intelligent Parallelization of Java 8 Streams ...
Safe Automated Refactoring for Intelligent Parallelization 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 Tool for Optimizing Java 8 Stream Software via Automated Refactoring
A Tool for Optimizing Java 8 Stream Software via Automated RefactoringA Tool for Optimizing Java 8 Stream Software via Automated Refactoring
A Tool for Optimizing Java 8 Stream Software via Automated Refactoring
 
Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...
Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...
Porting the NetBeans Java 8 Enhanced For Loop Lambda Expression Refactoring t...
 
Towards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
Towards Safe Refactoring for Intelligent Parallelization of Java 8 StreamsTowards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
Towards Safe Refactoring for Intelligent Parallelization of Java 8 Streams
 
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Proactive Empirical Assessment of New Language Feature Adoption via Automated...Proactive Empirical Assessment of New Language Feature Adoption via Automated...
Proactive Empirical Assessment of New Language Feature Adoption via Automated...
 
Detecting Broken Pointcuts using Structural Commonality and Degree of Interest
Detecting Broken Pointcuts using Structural Commonality and Degree of InterestDetecting Broken Pointcuts using Structural Commonality and Degree of Interest
Detecting Broken Pointcuts using Structural Commonality and Degree of Interest
 
Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...
Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...
Fraglight: Shedding Light on Broken Pointcuts in Evolving Aspect-Oriented Sof...
 
Fraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
Fraglight: Shedding Light on Broken Pointcuts Using Structural CommonalityFraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
Fraglight: Shedding Light on Broken Pointcuts Using Structural Commonality
 
Objective-C for Java Developers, Lesson 1
Objective-C for Java Developers, Lesson 1Objective-C for Java Developers, Lesson 1
Objective-C for Java Developers, Lesson 1
 

Recently uploaded

Toxic effects of heavy metals : Lead and Arsenic
Toxic effects of heavy metals : Lead and ArsenicToxic effects of heavy metals : Lead and Arsenic
Toxic effects of heavy metals : Lead and Arsenic
sanjana502982
 
Nucleophilic Addition of carbonyl compounds.pptx
Nucleophilic Addition of carbonyl  compounds.pptxNucleophilic Addition of carbonyl  compounds.pptx
Nucleophilic Addition of carbonyl compounds.pptx
SSR02
 
Nutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technologyNutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technology
Lokesh Patil
 
Mudde & Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...
Mudde &  Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...Mudde &  Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...
Mudde & Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...
frank0071
 
Introduction to Mean Field Theory(MFT).pptx
Introduction to Mean Field Theory(MFT).pptxIntroduction to Mean Field Theory(MFT).pptx
Introduction to Mean Field Theory(MFT).pptx
zeex60
 
Seminar of U.V. Spectroscopy by SAMIR PANDA
 Seminar of U.V. Spectroscopy by SAMIR PANDA Seminar of U.V. Spectroscopy by SAMIR PANDA
Seminar of U.V. Spectroscopy by SAMIR PANDA
SAMIR PANDA
 
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
University of Maribor
 
Richard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlandsRichard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlands
Richard Gill
 
Phenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvementPhenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvement
IshaGoswami9
 
Eukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptxEukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptx
RitabrataSarkar3
 
mô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốt
mô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốtmô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốt
mô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốt
HongcNguyn6
 
SAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdfSAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdf
KrushnaDarade1
 
20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx
Sharon Liu
 
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptxThe use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
MAGOTI ERNEST
 
Red blood cells- genesis-maturation.pptx
Red blood cells- genesis-maturation.pptxRed blood cells- genesis-maturation.pptx
Red blood cells- genesis-maturation.pptx
muralinath2
 
BREEDING METHODS FOR DISEASE RESISTANCE.pptx
BREEDING METHODS FOR DISEASE RESISTANCE.pptxBREEDING METHODS FOR DISEASE RESISTANCE.pptx
BREEDING METHODS FOR DISEASE RESISTANCE.pptx
RASHMI M G
 
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...
Ana Luísa Pinho
 
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
yqqaatn0
 
Leaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdfLeaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdf
RenuJangid3
 
Nucleic Acid-its structural and functional complexity.
Nucleic Acid-its structural and functional complexity.Nucleic Acid-its structural and functional complexity.
Nucleic Acid-its structural and functional complexity.
Nistarini College, Purulia (W.B) India
 

Recently uploaded (20)

Toxic effects of heavy metals : Lead and Arsenic
Toxic effects of heavy metals : Lead and ArsenicToxic effects of heavy metals : Lead and Arsenic
Toxic effects of heavy metals : Lead and Arsenic
 
Nucleophilic Addition of carbonyl compounds.pptx
Nucleophilic Addition of carbonyl  compounds.pptxNucleophilic Addition of carbonyl  compounds.pptx
Nucleophilic Addition of carbonyl compounds.pptx
 
Nutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technologyNutraceutical market, scope and growth: Herbal drug technology
Nutraceutical market, scope and growth: Herbal drug technology
 
Mudde & Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...
Mudde &  Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...Mudde &  Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...
Mudde & Rovira Kaltwasser. - Populism in Europe and the Americas - Threat Or...
 
Introduction to Mean Field Theory(MFT).pptx
Introduction to Mean Field Theory(MFT).pptxIntroduction to Mean Field Theory(MFT).pptx
Introduction to Mean Field Theory(MFT).pptx
 
Seminar of U.V. Spectroscopy by SAMIR PANDA
 Seminar of U.V. Spectroscopy by SAMIR PANDA Seminar of U.V. Spectroscopy by SAMIR PANDA
Seminar of U.V. Spectroscopy by SAMIR PANDA
 
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
Remote Sensing and Computational, Evolutionary, Supercomputing, and Intellige...
 
Richard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlandsRichard's aventures in two entangled wonderlands
Richard's aventures in two entangled wonderlands
 
Phenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvementPhenomics assisted breeding in crop improvement
Phenomics assisted breeding in crop improvement
 
Eukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptxEukaryotic Transcription Presentation.pptx
Eukaryotic Transcription Presentation.pptx
 
mô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốt
mô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốtmô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốt
mô tả các thí nghiệm về đánh giá tác động dòng khí hóa sau đốt
 
SAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdfSAR of Medicinal Chemistry 1st by dk.pdf
SAR of Medicinal Chemistry 1st by dk.pdf
 
20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx20240520 Planning a Circuit Simulator in JavaScript.pptx
20240520 Planning a Circuit Simulator in JavaScript.pptx
 
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptxThe use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
The use of Nauplii and metanauplii artemia in aquaculture (brine shrimp).pptx
 
Red blood cells- genesis-maturation.pptx
Red blood cells- genesis-maturation.pptxRed blood cells- genesis-maturation.pptx
Red blood cells- genesis-maturation.pptx
 
BREEDING METHODS FOR DISEASE RESISTANCE.pptx
BREEDING METHODS FOR DISEASE RESISTANCE.pptxBREEDING METHODS FOR DISEASE RESISTANCE.pptx
BREEDING METHODS FOR DISEASE RESISTANCE.pptx
 
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...
Deep Behavioral Phenotyping in Systems Neuroscience for Functional Atlasing a...
 
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
如何办理(uvic毕业证书)维多利亚大学毕业证本科学位证书原版一模一样
 
Leaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdfLeaf Initiation, Growth and Differentiation.pdf
Leaf Initiation, Growth and Differentiation.pdf
 
Nucleic Acid-its structural and functional complexity.
Nucleic Acid-its structural and functional complexity.Nucleic Acid-its structural and functional complexity.
Nucleic Acid-its structural and functional complexity.
 

Poster on Automated Refactoring of Legacy Java Software to Default Methods

  • 1. Automated Refactoring of Legacy Java Software to Default Methods Raffi Khatchadourian1 Hidehiko Masuhara2 1 Hunter College & the Graduate Center, City University of New York 2 Tokyo Institute of Technology Introduction Java 8 introduces enhanced interfaces, allowing for default (instance) methods that implementers will in- herit if none are provided [3]. Default methods can be used [2] as a replacement of the skeletal imple- mentation pattern [1], which creates abstract skeletal implementation classes that implementers extend. Migrating legacy code using the skeletal implementa- tion pattern to instead use default methods can re- quire significant manual effort due to subtle language and semantic restrictions. It requires preserving type- correctness by analyzing complex type hierarchies, re- solving issues arising from multiple inheritance, recon- ciling differences between class and interface methods, and ensuring tie-breakers with overriding class methods do not alter semantics. We propose an efficient, fully-automated, semantics- preserving refactoring approach, based on type con- straints [4,5] and implemented as an open source Eclipse plug-in, that assists developers in taking ad- vantage of enhanced interfaces. It identifies instances of the pattern and safely migrates class method imple- mentations to interfaces as default methods. Motivating Example Consider the following interface: 1 interface Collection<E> { 2 int size(); 3 void setSize(int i) throws Exception; 4 void add(E elem); // optional. 5 void removeLast(); 6 boolean isEmpty(); 7 int capacity();} And the following skeletal implementation classes: 1 abstract class AbstractCollection<E> implements Collection<E>, 2 Object[] elems; int size; // instance fields. 3 @Override public int size() {return this.size;} 4 @Override public void setSize(int i) {this.size = i;} 5 @Override public void add(E elem) 6 {throw new UnsupportedOperationException();}} 7 @Override public void removeLast() 8 {if (!isEmpty()) this.setSize(this.size()-1);} 9 @Override public boolean isEmpty() {return this.size()==0;} 10 @Override public int capacity() {return this.elems.length;}} Implementers now extend AbstractCollection to inherit the skeletal implementations of Collection: 1 // inherits skeletal implementations: 2 List<String> list = new AbstractList<>() {}; And override its methods as needed: 1 List<string> immutableList = new AbstractList<> { 2 @Override public void add(E elem) { 3 throw new UnsupportedOperationException();}} This pattern has several drawbacks, including: Inheritance. Implementers extending AbstractCollection cannot further extend. Modularity. No syntactic path between Collection and AbstractCollection. Bloated libraries. Skeletal implementation classes must be separate from interfaces. Refactoring Approach Can we refactor abstract skeletal implementation classes to instead utilize default methods? Type Constraints [E] the type of expression or declaration element E. [M] the declared return type of method M. Decl(M) the type that contains method M. Param(M, i) the i-th formal parameter of method M. T ≤ T T is equal to T, or T is a subtype of T. Figure 1: Type constraint notation (inspired by [5]). We use type constraints [4,5] to express refactoring preconditions. For each program element, type con- straints denote the subtyping relationships that must hold between corresponding expressions for that por- tion of the system to be considered well-typed. Thus, a complete program is type-correct if all constraints implied by all program elements hold. Fig. 2 depicts several constraints used. program construct implied type constraint(s) method call E.m(E1, . . . , En) to a virtual method M (throwing exceptions Ext1, . . . , Extj) [E.m(E1, . . . , En)] [M] (1) [Ei] ≤ [Param(M, i)] (2) [E] ≤ Decl(M1) ∨ · · · ∨ [E] ≤ Decl(Mk) (3) where RootDefs(M) = {M1, . . . , Mk} ∀Ext ∈ {Ext1, . . . , Extj} (4) ∃Exh ∈ Handle(E.m(E1, . . . , En)) [[Ext] ≤ [Exh]] access E.f to field F [E.f] [F] (5) [E] ≤ Decl(F) (6) Figure 2: Example type constraints. Inferring Type Constraints Type constraints are used to determine if a possible migration will either result in a type-incorrect or se- mantically different program. For example: • Migrating size() and capacity() from AbstractCollection to Collection implies that [this] = Collection, violating constraint (6) that [this] ≤ [AbstractCollection]. • Migrating AbstractCollection.setSize() to Collection implies that the method now throws an Exception, violating constraint (4) as Handle(this.setSize(this.size()-1)) = ∅. • add(), removeLast(), and isEmpty() from AbstractCollection can be safely migrated to Collection as a default method (Lst. 1) since there are no type constraint violations. 1 interface Collection<E> { 2 int size(); 3 void setSize(int i) throws Exception; 4 default void add(E elem) // optional. 5 {throw new UnsupportedOperationException();} 6 default void removeLast() 7 {if (!isEmpty()) this.setSize(this.size()-1);} 8 default boolean isEmpty() {return this.size()==0;} 9 int capacity(); 10 abstract class AbstractCollection<E> implements Collection<E> { 11 Object[] elems; int size; // instance fields. 12 @Override public int size() {return this.size;} 13 @Override public void setSize(int i) {this.size = i;} 14 @Override public void add(E elem) 15 {throw new UnsupportedOperationException();}} 16 @Override public void removeLast() 17 {if (!isEmpty()) this.setSize(this.size()-1);} 18 @Override public boolean isEmpty(){return this.size()==0;} 19 @Override public int capacity() {return this.elems.length;} 1: Refactored version. Evaluation subject KL KM cnds dflts fps δ -δ tm (s) ArtOfIllusion 118 6.94 16 1 34 1 0 3.65 Azureus 599 3.98 747 116 1366 31 2 61.83 Colt 36 3.77 69 4 140 3 0 6.76 elasticsearch 585 47.87 339 69 644 21 4 83.30 Java8 291 30.99 299 93 775 25 10 64.66 JavaPush 6 0.77 1 0 4 0 0 1.02 JGraph 13 1.47 16 2 21 1 0 3.12 JHotDraw 32 3.60 181 46 282 8 0 7.75 JUnit 26 3.58 9 0 25 0 0 0.79 MWDumper 5 0.40 11 0 24 0 0 0.29 osgi 18 1.81 13 3 11 2 0 0.76 rdp4j 2 0.26 10 8 2 1 0 1.10 spring 506 53.51 776 150 1459 50 13 91.68 Tomcat 176 16.15 233 31 399 13 0 13.81 verbose 4 0.55 1 0 1 0 0 0.55 VietPad 11 0.58 15 0 26 0 0 0.36 Violet 27 2.06 104 40 102 5 1 3.54 Wezzle2D 35 2.18 87 13 181 5 0 4.26 ZKoss 185 15.95 394 76 684 0 0 33.95 Totals: 2677 232.2 3321 652 6180 166 30 383.17 Table 1: Experimental results. Able to automatically migrate 19.63% (column dflts) of candidate methods despite of its conservatism. Figure 3: Precondition failures Preliminary Pull Request Study Submitted 19 pull requests to Java projects on GitHub, of which 4 have been successfully merged, 5 are open, and 10 were closed without merging. Merged projects totaled 163 watches, 1071 stars, and 180 forks. Projects rejecting requests citing reasons such as that they needed to support older Java clients. Conclusion We have presented an efficient, fully-automated, type constraint-based, semantics-preserving approach, fea- turing an exhaustive rule set, that migrates the skeletal implementation pattern in legacy Java code to instead use default methods. It is implemented as an Eclipse IDE plug-in and was evaluated on 19 open source projects. The results show that our tool scales and was able to refactor, despite its conservativeness and language constraints, 19.63% of all methods possibly participating in the pattern with minimal intervention. Our study highlights pattern usage and gives insight to language designers on applicability to existing software. References [1] Joshua Bloch. Effective Java. Prentice Hall, 2008. [2] Brian Goetz. Interface evolution via virtual extensions methods. Tech- nical report, Oracle Corporation, June 2011. [3] Oracle Corporation. Java Programming Language Enhancements. [4] Jens Palsberg and Michael I. Schwartzbach. Object-oriented type sys- tems. John Wiley and Sons Ltd., 1994. [5] Frank Tip, Robert M. Fuhrer, Adam Kieżun, Michael D. Ernst, Ittai Bal- aban, and Bjorn De Sutter. Refactoring using type constraints. ACM TOPLAS, 33(3):9:1–9:47, May 2011. International Conference on Software Engineering, May 20–28, 2017, Buenos Aires, Argentina