Computing Reviews
Today's Issue Hot Topics Search Browse Recommended My Account Log In
Review Help
Search
Safe instantiation in generic Java
Allen E., Cartwright R. Science of Computer Programming59 (1-2):26-37,2006.Type:Article
Date Reviewed: Jul 19 2006

Responding to a broadly perceived need to include generic types within Java, developers released Java 1.5. The authors critique this version on the grounds of type safety, and they introduce a principle that can be used to improve the language.

In revising Java, the developers were constrained by a need to remain backward compatible with existing code, so the Java Virtual Machine could not be changed. To achieve generic types, the developers implemented the type-erasure translation model, which generates one piece of code with the underlying types cast into an upward bound type. Type information is not available at runtime.

The authors point out issues with type safety in the new version of Java, and they articulate the safe instantiation principle, which they use to assess three implementations of generics in Java. The principle asserts that instantiating a generic class should not generate type errors during execution or compilatio!n.

The three implementations are GJ, which underlies Java 1.5; NextGen; and MixGen. GJ is amply and reasonably critiqued for its inelegant combining of generic and nongeneric, and for its lack of type safety that results from type erasure. The authors note that in NextGen, safe instantiation is compromised by the creation of new instances of type parameters. They propose improving it with a clause that constrains constructors. The authors go on to note that MixGen must meet challenges regarding the safe instantiation of super classes.

The authors articulate a useful design principle. They remove the sting of their criticisms by proposing solutions to problems and by recognizing that, despite the terseness and clarity of their principle, it is extraordinarily difficult to implement.

Reviewer:  Marlin Thomas Review #: CR133093 (0705-0482)
Bookmark and Share
  Featured Reviewer  
 
Polymorphism (D.3.3 ... )
 
 
Data Types And Structures (D.3.3 ... )
 
 
Java (D.3.2 ... )
 
 
Object-Oriented Programming (D.2.3 ... )
 
 
Coding Tools and Techniques (D.2.3 )
 
 
Language Classifications (D.3.2 )
 
  more  
Would you recommend this review?
yes
no
Other reviews under "Polymorphism": Date
Formalization of generics for the .NET common language runtime
Yu D., Kennedy A., Syme D. ACM SIGPLAN Notices 39(1): 39-51, 2004. Type: Article
Mar 10 2004
Polymorphic typed defunctionalization
Pottier F., Gauthier N. ACM SIGPLAN Notices 39(1): 89-98, 2004. Type: Article
Mar 11 2004
Parametric polymorphism for XML
Hosoya H., Frisch A., Castagna G.  Principles of programming languages (Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Long Beach, California, USA, Jan 12-14, 2005)50-62, 2005. Type: Proceedings
Apr 7 2005
more...

E-Mail This Printer-Friendly
Send Your Comments
Contact Us
Reproduction in whole or in part without permission is prohibited.   Copyright 1999-2024 ThinkLoud®
Terms of Use
| Privacy Policy