Title
Refactoring Java generics by inferring wildcards, in practice
Abstract
Wildcard annotations can improve the generality of Java generic libraries, but require heavy manual effort. We present an algorithm for refactoring and inferring more general type instantiations of Java generics using wildcards. Compared to past approaches, our work is practical and immediately applicable: we assume no changes to the Java type system, while taking into account all its intricacies. Our system allows users to select declarations (variables, method parameters, return types, etc.) to generalize and considers declarations not declared in available source code. It then performs an inter-procedural flow analysis and a method body analysis, in order to generalize type signatures. We evaluate our technique on six Java generic libraries. We find that 34% of available declarations of variant type signatures can be generalized - i.e., relaxed with more general wildcard types. On average, 146 other declarations need to be updated when a declaration is generalized, showing that this refactoring would be too tedious and error-prone to perform manually.
Year
DOI
Venue
2014
10.1145/2660193.2660203
OOPSLA
Keywords
Field
DocType
refactoring,variance,use-site variance,classes and objects,generics,abstract data types,wildcards,polymorphism,definition-site variance
Declaration,Wildcard,Programming language,Wildcard character,Source code,Computer science,Theoretical computer science,Generics in Java,Code refactoring,Java,Generality
Conference
Volume
Issue
ISSN
49
10
0362-1340
Citations 
PageRank 
References 
0
0.34
9
Authors
2
Name
Order
Citations
PageRank
John Altidor161.15
Yannis Smaragdakis22247147.50