Home > Programming > Java Programming
GJ: Extending the Java programming language with type parameters
Sort Desciption:This note proposes GJ an extension to the Java programming language that ... GJ is backward and forward compatible with the Java programming language and ...
Content Inside:GJ: Extending the Java programming language with type parametersPage 1GJ: Extending the JavaTMprogramming language with typeparametersGilad Bracha Sun MicrosystemsMartin Odersky University of South AustraliaDavid Stoutamire Sun MicrosystemsPhilip Wadler Bell Labs Lucent TechnologiesMarch 1998; revised August 1998Say you wish to process collections. Some may be collections of bytes others collections of strings and yet others collections of collections of strings. The Java programming language supports such variation by allowing you to form a collection of Objectso the elements may have any reference type. In order to keep the language simpleyou are forced to do some of the work yourself: you must keep track of the fact thatyou have a collection of bytes and when you extract an element from the collection youmust cast it to class Byte before further processing.This situation is becoming more common as the Java platform evolves notably withthe addition of collection classes to JDK 1.2. Other languages provide additional supportfor this situation: in C++ it is supported with templates; in Ada it is supported withgenerics; and in ML and Haskell it is supported with parametric polymorphism.This note proposes GJ an extension to the Java programming language that supports types with parameters. GJ programs look much like the equivalent Java programsexcept they have more type information and fewer casts. The semantics of GJ is givenby a translation into the Java programming language. The translation erases type parameters replaces type variables by their bounding type (typically Object) adds castsand inserts bridge methods so that overriding works properly. The resulting programis pretty much what you would write if generics werent available. The translation isdesigned so that new GJ code will work with existing Java libraries even when thelibraries are available only in binary class file form.GJ comes with a castiron guarantee: no cast inserted by the compiler will ever fa ...
Source: homepages.inf.ed.ac.uk
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Related Files
<>An Introduction to Java Programming
Filed under: Programming and Java ProgrammingType java Welcome to run the program. A sample run of ... You can run the Java program from the DOS prompt using. the java command. ...
Java Server Programming: Principles and Technologies
Filed under: Programming and Java Programminglargescale serverside applications using the Java programming language. ... Professional java server programming J2EE edition. Wrox Press Inc. ...
Java Programming Language SL275
Filed under: Programming and Java Programminglanguage; objectoriented programming. with the Java programming language; and ... SL275: Java Programming Language. 2 of 5. Sun Educational Services ...
Java 2 Enterprise Edition (J2EE) Certificate Program
Filed under: Programming and Java Programmingthat are available with the Java programming language. and development environment. .... database tasks and transactions from a Java program. ...
Programming mobile devices with J2ME
Filed under: Programming and Java ProgrammingJava's interfaces, with the possibility of using a layer programming structure in ... For example the access to a built-in camera in a mobile phone by means of ...
