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 (20)

Java interface
Java interfaceJava interface
Java interface
BHUVIJAYAVELU
 
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 Java
parag
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritance
Arjun Shanka
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;s
vivek p s
 
Interface java
Interface java Interface java
Interface java
atiafyrose
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
jehan1987
 
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
 
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
 
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
 
Interfaces In Java
Interfaces In JavaInterfaces In Java
Interfaces In Java
parag
 
java-06inheritance
java-06inheritancejava-06inheritance
java-06inheritance
Arjun Shanka
 
Object Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;sObject Oriented Principle&rsquo;s
Object Oriented Principle&rsquo;s
vivek p s
 

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...
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
Methods
Andy Juan Sarango Veliz
 
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
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Rafael Coutinho
 
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
 
final
finalfinal
final
Erick Miller
 
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
Introduction to new features in java 8
Raffi Khatchadourian
 
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
 
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
 
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
 
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
 
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
Introduction to new features in java 8
Raffi Khatchadourian
 

More from Raffi Khatchadourian (20)

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
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
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
 
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
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Raffi Khatchadourian
 
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
Hybridize Functions: A Tool for Automatically Refactoring Imperative Deep Lea...
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
 

Recently uploaded (20)

Animal Models for Biological and Clinical Research ppt 2.pptx
Animal Models for Biological and Clinical Research ppt 2.pptxAnimal Models for Biological and Clinical Research ppt 2.pptx
Animal Models for Biological and Clinical Research ppt 2.pptx
MahitaLaveti
 
Secondary metabolite ,Plants and Health Care
Secondary metabolite ,Plants and Health CareSecondary metabolite ,Plants and Health Care
Secondary metabolite ,Plants and Health Care
Nistarini College, Purulia (W.B) India
 
Euclid: The Story So far, a Departmental Colloquium at Maynooth University
Euclid: The Story So far, a Departmental Colloquium at Maynooth UniversityEuclid: The Story So far, a Departmental Colloquium at Maynooth University
Euclid: The Story So far, a Departmental Colloquium at Maynooth University
Peter Coles
 
Proprioceptors_ receptors of muscle_tendon
Proprioceptors_ receptors of muscle_tendonProprioceptors_ receptors of muscle_tendon
Proprioceptors_ receptors of muscle_tendon
klynct
 
Batteries and fuel cells for btech first year
Batteries and fuel cells for btech first yearBatteries and fuel cells for btech first year
Batteries and fuel cells for btech first year
MithilPillai1
 
Year 7 unit Earth and Space slides .pptx
Year 7 unit Earth and Space slides .pptxYear 7 unit Earth and Space slides .pptx
Year 7 unit Earth and Space slides .pptx
boushrasabbagh
 
Siver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptx
Siver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptxSiver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptx
Siver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptx
PriyaAntil3
 
Adamson, Walter L. - Avant-Garde Florence. From Modernism to Fascism [ocr] [...
Adamson, Walter L.  - Avant-Garde Florence. From Modernism to Fascism [ocr] [...Adamson, Walter L.  - Avant-Garde Florence. From Modernism to Fascism [ocr] [...
Adamson, Walter L. - Avant-Garde Florence. From Modernism to Fascism [ocr] [...
Francisco Sandoval Martínez
 
Hemorrhagic Fever from Venezuala Medical Virology.pptx
Hemorrhagic Fever from Venezuala Medical Virology.pptxHemorrhagic Fever from Venezuala Medical Virology.pptx
Hemorrhagic Fever from Venezuala Medical Virology.pptx
wamunsmith
 
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptxA CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
ANJALICHANDRASEKARAN
 
Fatigue and its management in aviation medicine
Fatigue and its management in aviation medicineFatigue and its management in aviation medicine
Fatigue and its management in aviation medicine
ImranJewel2
 
Reticular formation_groups_organization_
Reticular formation_groups_organization_Reticular formation_groups_organization_
Reticular formation_groups_organization_
klynct
 
Seismic evidence of liquid water at the base of Mars' upper crust
Seismic evidence of liquid water at the base of Mars' upper crustSeismic evidence of liquid water at the base of Mars' upper crust
Seismic evidence of liquid water at the base of Mars' upper crust
Sérgio Sacani
 
The Microbial World. Microbiology , Microbes, infections
The Microbial World. Microbiology , Microbes, infectionsThe Microbial World. Microbiology , Microbes, infections
The Microbial World. Microbiology , Microbes, infections
NABIHANAEEM2
 
Scientific Practices and Methods Part 1.pptx
Scientific Practices and Methods  Part 1.pptxScientific Practices and Methods  Part 1.pptx
Scientific Practices and Methods Part 1.pptx
MrsLeferJohnson
 
Evolution of Man || Palaentology || Geology
Evolution of Man || Palaentology || GeologyEvolution of Man || Palaentology || Geology
Evolution of Man || Palaentology || Geology
Abhiroop Singh
 
Funakoshi_ZymoResearch_2024-2025_catalog
Funakoshi_ZymoResearch_2024-2025_catalogFunakoshi_ZymoResearch_2024-2025_catalog
Funakoshi_ZymoResearch_2024-2025_catalog
fu7koshi
 
Fire Prevention and protection 1123.pptx
Fire Prevention and protection 1123.pptxFire Prevention and protection 1123.pptx
Fire Prevention and protection 1123.pptx
091HarshikaModi
 
Preparation of Experimental Animals.pptx
Preparation of Experimental Animals.pptxPreparation of Experimental Animals.pptx
Preparation of Experimental Animals.pptx
klynct
 
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of AmsterdamA tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
Richard Gill
 
Animal Models for Biological and Clinical Research ppt 2.pptx
Animal Models for Biological and Clinical Research ppt 2.pptxAnimal Models for Biological and Clinical Research ppt 2.pptx
Animal Models for Biological and Clinical Research ppt 2.pptx
MahitaLaveti
 
Euclid: The Story So far, a Departmental Colloquium at Maynooth University
Euclid: The Story So far, a Departmental Colloquium at Maynooth UniversityEuclid: The Story So far, a Departmental Colloquium at Maynooth University
Euclid: The Story So far, a Departmental Colloquium at Maynooth University
Peter Coles
 
Proprioceptors_ receptors of muscle_tendon
Proprioceptors_ receptors of muscle_tendonProprioceptors_ receptors of muscle_tendon
Proprioceptors_ receptors of muscle_tendon
klynct
 
Batteries and fuel cells for btech first year
Batteries and fuel cells for btech first yearBatteries and fuel cells for btech first year
Batteries and fuel cells for btech first year
MithilPillai1
 
Year 7 unit Earth and Space slides .pptx
Year 7 unit Earth and Space slides .pptxYear 7 unit Earth and Space slides .pptx
Year 7 unit Earth and Space slides .pptx
boushrasabbagh
 
Siver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptx
Siver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptxSiver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptx
Siver Nanoparticles syntheisis, mechanism, Antibacterial activity.pptx
PriyaAntil3
 
Adamson, Walter L. - Avant-Garde Florence. From Modernism to Fascism [ocr] [...
Adamson, Walter L.  - Avant-Garde Florence. From Modernism to Fascism [ocr] [...Adamson, Walter L.  - Avant-Garde Florence. From Modernism to Fascism [ocr] [...
Adamson, Walter L. - Avant-Garde Florence. From Modernism to Fascism [ocr] [...
Francisco Sandoval Martínez
 
Hemorrhagic Fever from Venezuala Medical Virology.pptx
Hemorrhagic Fever from Venezuala Medical Virology.pptxHemorrhagic Fever from Venezuala Medical Virology.pptx
Hemorrhagic Fever from Venezuala Medical Virology.pptx
wamunsmith
 
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptxA CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
A CASE OF MULTINODULAR GOITRE,clinical presentation and management.pptx
ANJALICHANDRASEKARAN
 
Fatigue and its management in aviation medicine
Fatigue and its management in aviation medicineFatigue and its management in aviation medicine
Fatigue and its management in aviation medicine
ImranJewel2
 
Reticular formation_groups_organization_
Reticular formation_groups_organization_Reticular formation_groups_organization_
Reticular formation_groups_organization_
klynct
 
Seismic evidence of liquid water at the base of Mars' upper crust
Seismic evidence of liquid water at the base of Mars' upper crustSeismic evidence of liquid water at the base of Mars' upper crust
Seismic evidence of liquid water at the base of Mars' upper crust
Sérgio Sacani
 
The Microbial World. Microbiology , Microbes, infections
The Microbial World. Microbiology , Microbes, infectionsThe Microbial World. Microbiology , Microbes, infections
The Microbial World. Microbiology , Microbes, infections
NABIHANAEEM2
 
Scientific Practices and Methods Part 1.pptx
Scientific Practices and Methods  Part 1.pptxScientific Practices and Methods  Part 1.pptx
Scientific Practices and Methods Part 1.pptx
MrsLeferJohnson
 
Evolution of Man || Palaentology || Geology
Evolution of Man || Palaentology || GeologyEvolution of Man || Palaentology || Geology
Evolution of Man || Palaentology || Geology
Abhiroop Singh
 
Funakoshi_ZymoResearch_2024-2025_catalog
Funakoshi_ZymoResearch_2024-2025_catalogFunakoshi_ZymoResearch_2024-2025_catalog
Funakoshi_ZymoResearch_2024-2025_catalog
fu7koshi
 
Fire Prevention and protection 1123.pptx
Fire Prevention and protection 1123.pptxFire Prevention and protection 1123.pptx
Fire Prevention and protection 1123.pptx
091HarshikaModi
 
Preparation of Experimental Animals.pptx
Preparation of Experimental Animals.pptxPreparation of Experimental Animals.pptx
Preparation of Experimental Animals.pptx
klynct
 
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of AmsterdamA tale of two Lucies: talk at the maths dept, Free University of Amsterdam
A tale of two Lucies: talk at the maths dept, Free University of Amsterdam
Richard Gill
 

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
  翻译: