jakarta-jcs-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Pettypiece" <Mike.Pettypi...@EMBARCADERO.COM>
Subject RE: xml config prototype
Date Fri, 23 Apr 2004 20:19:14 GMT
Generics are different from C++ templates.  There is only one copy of
the generic class compiled (as opposed to one for each typed instance).

http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf

Look at Chapter 2:  Defining Simple Generics (The paragraph starts "It
is misleading...")

Cheers,

Mike


-----Original Message-----
From: Travis Savo [mailto:tsavo@IFILM.com] 
Sent: Friday, April 23, 2004 3:23 PM
To: 'Turbine JCS Users List'
Subject: RE: xml config prototype

I knew I remembered seeing something about this! Thanks, Hanson.

It makes sense, doesn't it?

You -know- the type of the parameterized variable at compile time... why
can't you just generate an implementation of the class which uses that
type?
That's some pretty standard bytecode that you could probably make 1.1
compatible if you tried hard enough.

Isn't this what 1.5 does anyway for generics? Generate an implementation
of each typed instance? I know that's how it works with C++ templates.

Or am I smoking crack? Anything's possible...

-Travis Savo


-----Original Message-----
From: Hanson Char [mailto:hanson_char@yahoo.com]
Sent: Friday, April 23, 2004 7:46 AM
To: 'Turbine JCS Users List'
Subject: RE: xml config prototype


>Sadly the currently 1.5beta release does not allow generics to be 
>compiled
to earlier jdk versions.

The above statement is actually not true.  Just found out (from
IntelliJIDEA
4.0) in jdk1.5 beta there is an "unofficial" compiler option (ie not
documented in Sun's jdk) that will generate bytecode from source using
generics that can be run in a jdk1.4 JVM:

eg, using jdk1.5 beta compiler:

	javac -source 1.5 -target jsr14 TestGenerics.java

Cheers,
Hanson


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
turbine-jcs-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail:
turbine-jcs-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-jcs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-jcs-user-help@jakarta.apache.org


Mime
View raw message