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 per- forms 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 30% of available declarations of variant type signatures can be generalized—i.e., relaxed with more general wildcard types. On average, 228 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.
Video: http://www.infoq.com/presentations/java-generics-wildcards
Refactoring Java Generics by Inferring Wildcards, In Practice (oopsla2014-altidor.pdf) | 702KiB |
Thu 23 OctDisplayed time zone: Tijuana, Baja California change
10:30 - 12:00 | |||
10:30 22mTalk | Rate Types for Stream Programs OOPSLA Link to publication File Attached | ||
10:52 22mTalk | Foundations of Path-Dependent Types OOPSLA Nada Amin EPFL, Tiark Rompf Purdue & Oracle Labs, Martin Odersky Ecole Polytechnique Federale de Lausanne Link to publication File Attached | ||
11:15 22mTalk | Confined Gradual Typing OOPSLA Esteban Allende , Johan Fabry University of Chile, Ronald Garcia University of British Columbia, Éric Tanter University of Chile Link to publication | ||
11:37 22mTalk | Refactoring Java Generics by Inferring Wildcards, In Practice OOPSLA Link to publication File Attached |