Genericity in Java: persistent and database systems implications

Lack of parametric polymorphism has been a major obstacle for making Java a viable database programming language. Regrettably, a recently accepted solution for genericity in Java 5.0 has far-reaching negative implications for persistent and database systems because of static and dynamic type violations. Severe implications occur in typical database transactions when processing a variety of database collections. Well-known approaches to persistence in Java, including Java’s own persistence mechanism, do not perform correctly due to incorrect dynamic type information that gets promoted to persistence along with objects. Dynamic checking of types of objects fetched from the persistent store may now lead to unexpected type violations. Further problems occur in reflective transactions as Java Core Reflection now allows dynamic type violations without detecting them or throwing standard exceptions. All of this shows that extending Java with parametric polymorphism has not made Java a more viable database programming language. Both legacy systems, such as those based on the Java binding of the ODMG or JDO, and future Java-related persistent and database technologies will be affected. The source of these problems is in an implementation idiom called type erasure. This paper provides formal proofs of the above implications of type erasure along with specific samples of code in Java 5.0 illustrating these violations. The limitations of the virtual platform and extensions required for persistent systems to solve this problem are also elaborated.

[1]  R. G. G. Cattell,et al.  Recent books , 2000, IEEE Spectrum.

[2]  Maydene Fisher,et al.  JDBC¿ API Tutorial and Reference , 2003 .

[3]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[4]  Andrew Kennedy,et al.  Design and implementation of generics for the .NET Common language runtime , 2001, PLDI '01.

[5]  Malcolm P. Atkinson,et al.  An orthogonally persistent Java , 1996, SGMD.

[6]  Dachuan Yu,et al.  Formalization of generics for the .NET common language runtime , 2004, POPL.

[7]  Jens Palsberg,et al.  Object-oriented type systems , 1994, Wiley professional computing.

[8]  Kim B. Bruce Foundations of object-oriented languages - types and semantics , 2002 .

[9]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 2001, TOPL.

[10]  Robert Cartwright,et al.  A first-class approach to genericity , 2003, OOPSLA '03.

[11]  Robert Cartwright,et al.  Efficient Implementation of Run-time Generic Types for Java , 2002, Generic Programming.

[12]  Sophia Drossopoulou,et al.  Java is Type Safe - Probably , 1997, ECOOP.

[13]  Malcolm P. Atkinson,et al.  Orthogonal Persistence for Java? - A Mid-term Report , 1998, POS/PJW.

[14]  Suad Alagic,et al.  Parametric polymorphism for Java: a reflective solution , 1998, OOPSLA '98.

[15]  Suad Alagic,et al.  Parametric polymorphism for Java: is there any hope in sight? , 2004, SIGP.

[16]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 1999, OOPSLA '99.

[17]  Ronald Morrison,et al.  Orthogonally persistent object systems , 1995, The VLDB Journal.

[18]  Suad Alagic,et al.  Parametric Polymorphism and Orthogonal Persistence , 2000, Objects and Databases.

[19]  Suad Alagic,et al.  The ODMG object model: does it make sense? , 1997, OOPSLA '97.

[20]  Suad Alagic,et al.  Type-checking OQL queries in the ODMG type systems , 1999, TODS.

[21]  John C. Mitchell,et al.  F-bounded polymorphism for object-oriented programming , 1989, FPCA.

[22]  Mirko Viroli,et al.  Parametric polymorphism in Java: an approach to translation based on reflective features , 2000, OOPSLA '00.

[23]  David J. DeWitt,et al.  The Object-Oriented Database System Manifesto , 1994, Building an Object-Oriented Database System, The Story of O2.

[24]  Ken Arnold,et al.  The Java programming language (2nd ed.) , 1998 .

[25]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[26]  James Gosling,et al.  The Java Language Specification, 3rd Edition , 2005 .

[27]  Guy L. Steele,et al.  Java(TM) Language Specification, The (3rd Edition) (Java (Addison-Wesley)) , 2005 .

[28]  Kim B. Bruce,et al.  PolyTOIL: A Type-Safe Polymorphic Object-Oriented Language , 1995, ECOOP.

[29]  Stephen N. Freund,et al.  Adding type parameterization to the Java language , 1997, OOPSLA '97.

[30]  Suad Alagic,et al.  Java and OQL: A Reflective Solution for the Impedance Mismatch , 2000, Obj. Logiciel Base données Réseaux.

[31]  Benjamin C. Pierce,et al.  Foundations of Object-Oriented Languages - Introduction , 1999, Theory Pract. Object Syst..

[32]  Robert Cartwright,et al.  Compatible genericity with run-time types for the Java programming language , 1998, OOPSLA '98.

[33]  Gavin M. Bierman,et al.  The Essence of Data Access in Comega , 2005, European Conference on Object-Oriented Programming.

[34]  R. Venkatesh,et al.  Persistent Java Objects in 3 Tier Architectures , 1998, POS/PJW.

[35]  Andrew C. Myers,et al.  Parameterized types for Java , 1997, POPL '97.

[36]  Ken Arnold,et al.  Java(TM) Programming Language, The (4th Edition) , 2005 .

[37]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[38]  David Jordan,et al.  Java data objects , 2003 .

[39]  Martin Odersky,et al.  Pizza into Java: translating theory into practice , 1997, POPL '97.

[40]  Ronald Morrison,et al.  Linguistic reflection in Java , 1998, Softw. Pract. Exp..

[41]  Tobias Nipkow,et al.  Javalight is type-safe—definitely , 1998, POPL '98.