|
ABSTRACT
Java 1.5 will include a type system (called JSR-14) that supports <i>parametric polymorphism</i>, or <i>generic</i> classes. This will bring many benefits to Java programmers, not least because current Java practice makes heavy use of logically-generic classes, including container classes. Translation of Java source code into semantically equivalent JSR-14 source code requires two steps: parameterization (adding type parameters to class definitions) and instantiation (adding the type arguments at each use of a parameterized class). Parameterization need be done only once for a class, whereas instantiation must be performed for each client, of which there are potentially many more. Therefore, this work focuses on the instantiation problem. We present a technique to determine sound and precise JSR-14 types at each use of a class for which a generic type specification is available. Our approach uses a precise and context-sensitive pointer analysis to determine possible types at allocation sites, and a set-constraint-based analysis (that incorporates guarded, or conditional, constraints) to choose consistent types for both allocation and declaration sites. The technique handles all features of the JSR-14 type system, notably the raw types that provide backward compatibility. We have implemented our analysis in a tool that automatically inserts type parameters into Java code, and we report its performance when applied to a number of real-world Java programs.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
 |
2
|
|
 |
3
|
David F. Bacon , Peter F. Sweeney, Fast static analysis of C++ virtual function calls, Proceedings of the 11th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.324-341, October 06-10, 1996, San Jose, California, United States
|
| |
4
|
G. Bracha, N. Cohen, C. Kemper, S. Mark, M. Odersky, S.-E. Panitz, D. Stoutamire, K. Thorup, and P. Wadler. Adding generics to the Java programming language: Participant draft specification. Technical report, Sun Microsystems, Apr. 27, 2001.
|
| |
5
|
G. Bracha, M. Odersky, D. Stoutamire, and P. Wadler. GJ specification. http://www.cis.unisa.edu.au/ pizza/gj/Documents/#gj-specification, May 1998.
|
 |
6
|
Gilad Bracha , Martin Odersky , David Stoutamire , Philip Wadler, Making the future safe for the past: adding genericity to the Java programming language, Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.183-200, October 18-22, 1998, Vancouver, British Columbia, Canada
|
 |
7
|
|
 |
8
|
|
 |
9
|
Robert Cartwright , Guy L. Steele, Jr., Compatible genericity with run-time types for the Java programming language, Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.201-215, October 18-22, 1998, Vancouver, British Columbia, Canada
|
 |
10
|
C. Chambers , D. Ungar, Customization: optimizing compiler technology for SELF, a dynamically-typed object-oriented programming language, Proceedings of the ACM SIGPLAN 1989 Conference on Programming language design and implementation, p.146-160, June 19-23, 1989, Portland, Oregon, United States
|
 |
11
|
C. Chambers , D. Ungar , E. Lee, An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes, Conference proceedings on Object-oriented programming systems, languages and applications, p.49-70, October 02-06, 1989, New Orleans, Louisiana, United States
|
| |
12
|
OmniCore CodeGuide. http://www.omnicore.com/codeguide.htm.
|
| |
13
|
B. De Sutter, F. Tip, and J. Dolby. Customization of Java library classes using type constraints and profile information. In ECOOP, June 2004.
|
| |
14
|
|
| |
15
|
A. Donovan. Converting Java programs to use generic libraries. Master's thesis, MIT Dept. of EECS, Sept. 2004.
|
| |
16
|
A. Donovan and M. D. Ernst. Inference of generic types in Java. Technical Report MIT/ LCS/ TR-889, MIT Lab for Computer Science, Mar. 22, 2003.
|
 |
17
|
Dominic Duggan, Modular type-based reverse engineering of parameterized types in Java code, Proceedings of the 14th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.97-113, November 01-05, 1999, Denver, Colorado, United States
|
| |
18
|
Eclipse project. http://www.eclipse.org/.
|
 |
19
|
Jonathan Eifrig , Scott Smith , Valery Trifonov, Sound polymorphic type inference for objects, Proceedings of the tenth annual conference on Object-oriented programming systems, languages, and applications, p.169-184, October 15-19, 1995, Austin, Texas, United States
|
| |
20
|
|
| |
21
|
|
 |
22
|
|
| |
23
|
|
| |
24
|
JetBrains IntelliJ IDEA. http://www.intellij.com/idea/.
|
| |
25
|
A. Igarashi, B. C. Pierce, and P. Wadler. A recipe for raw types. In FOOL, London, Jan. 2001.
|
| |
26
|
|
| |
27
|
JavaSoft, Sun Microsystems. Prototype for JSR014: Adding generics to the Java programming language v. 1.3. http://jcp.org/jsr/detail/14.html, May 7, 2001.
|
 |
28
|
|
| |
29
|
|
| |
30
|
R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17(3):348--375, 1978.
|
 |
31
|
|
| |
32
|
|
 |
33
|
|
 |
34
|
A. Ohori , P. Buneman, Static type inference for parametric classes, Conference proceedings on Object-oriented programming systems, languages and applications, p.445-450, October 02-06, 1989, New Orleans, Louisiana, United States
|
 |
35
|
Jens Palsberg , Michael I. Schwartzbach, Object-oriented type inference, Conference proceedings on Object-oriented programming systems, languages, and applications, p.146-161, October 06-11, 1991, Phoenix, Arizona, United States
|
| |
36
|
|
| |
37
|
|
 |
38
|
John Plevyak , Andrew A. Chien, Precise concrete type inference for object-oriented languages, Proceedings of the ninth annual conference on Object-oriented programming systems, language, and applications, p.324-340, October 23-28, 1994, Portland, Oregon, United States
|
 |
39
|
|
| |
40
|
|
| |
41
|
|
| |
42
|
F. Tip, R. Fuhrer, J. Dolby, and A. Kiežun. Refactoring techniques for migrating applications to generic Java container classes. IBM Research Report RC 23238, IBM T.J. Watson Research Center, Yorktown Heights, NY, USA, June 2, 2004.
|
 |
43
|
Frank Tip , Adam Kiezun , Dirk Bäumer, Refactoring for generalization using type constraints, Proceedings of the 18th annual ACM SIGPLAN conference on Object-oriented programing, systems, languages, and applications, October 26-30, 2003, Anaheim, California, USA
|
 |
44
|
Frank Tip , Jens Palsberg, Scalable propagation-based call graph construction algorithms, Proceedings of the 15th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, p.281-293, October 2000, Minneapolis, Minnesota, United States
|
 |
45
|
Mads Torgersen , Christian Plesner Hansen , Erik Ernst , Peter von der Ahé , Gilad Bracha , Neal Gafter, Adding wildcards to the Java programming language, Proceedings of the 2004 ACM symposium on Applied computing, March 14-17, 2004, Nicosia, Cyprus
[doi> 10.1145/967900.968162]
|
| |
46
|
R. Vallée-Rai, L. Hendren, V. Sundaresan, P. Lam, E. Gagnon, and P. Co. Soot - a Java bytecode optimization framework. In CASCON, pages 125--135, Nov. 1999.
|
 |
47
|
Daniel von Dincklage , Amer Diwan, Converting Java classes to use generics, Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 24-28, 2004, Vancouver, BC, Canada
|
| |
48
|
|
 |
49
|
|
CITED BY 13
|
|
|
|
|
Adam Kieżun , Robert Fuhrer , Frank Tip , Markus Keller, Generics-related refactorings in eclipse, Companion to the 20th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 16-20, 2005, San Diego, CA, USA
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
INDEX TERMS
Primary Classification:
D.
Software
D.1
PROGRAMMING TECHNIQUES
D.1.5
Object-oriented Programming
Additional Classification:
D.
Software
D.2
SOFTWARE ENGINEERING
D.2.2
Design Tools and Techniques
Subjects:
Modules and interfaces
D.3
PROGRAMMING LANGUAGES
D.3.3
Language Constructs and Features
Subjects:
Data types and structures
General Terms:
Experimentation,
Languages,
Theory
Keywords:
JSR-14,
Java 1.5,
Java 5,
generic types,
instantiation types,
parameterized types,
parametric polymorphism,
raw types,
type inference
|