2004 · 17 citations · 11 references
ComputingComputer ScienceContainerizationProgramming LanguagesSystems ProgrammingApplication Programming InterfacesGeneric ProgrammingObject-oriented ProgrammingSoftware RefactoringType CheckingType SystemsConstraintsContainer RefactoringContext-sensitivityObject-oriented RefactoringObjectsOpen-source Software DevelopmentReusable ContainersType Constraints
Version 1.5 of the Java programming language will include gener-ics, a language construct for associating typeparameterswith classes and methods. Generics are particularly useful for creating statically type-safe, reusable container classes such that a store of an inappro-priate type causes a compile-time error, and that no down-casting is needed when retrieving elements. The standard libraries released with Java 1.5 will include generic versions of popular container classes such as HashMap and ArrayList. This paper presents a method for refactoring Java programs that use current container classes into equivalent Java 1.5 programs that use their new generic counterparts. Our method uses a variation on an existing model of type constraints to infer the element types of container objects, and it is parameterized by how much, if any, context sensitivity to exploit when generating these type constraints. We present both a context-insensitive instantiation of the framework and one using a low-cost variation on Agesen’s Cartesian Product Algorithm. The method has been implemented in Eclipse, a popular open-source development environment for Java. We evaluated our approach on several small benchmark programs, and found that, in all but one case, between 40 % and 100 % of all casts can be removed. 1.
11
Making the future safe for the past
Gilad Bracha, Martin Odersky, David Stoutamire et al. · 1998 · 503 citations · Full text
Martin Odersky, Philip Wadler · 1997 · 419 citations · Full text
Refactoring for generalization using type constraints
Frank Tip, Adam Kieżun, Dirk Bäumer · 2003 · 125 citations