Skip to Main Content

Java APIs

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Generics and C Templates

843793Dec 23 2003 — edited Dec 29 2003
I'm familiar with Java generics and I think I read the way those are implemented is different from C Templates beause C templates generate much more code.

I know I could answer my own question by reading a few white papers and grabbing some books, but all I want a quick answer to these questions:
1) When you instantiate a C template you generate the binary code equivalent to implementing the generic code in the particular type, so there binary code repetition, right?
2) For every generic java class you get 1 binary (bytecode), right?

So how exactly does the gjava compiler deal with the diferent casts needed if you instantiate a list of trees or a list of persons without repeating code?

I may be a bit lost in the implementation details, but feel free to be technical if you want.

When I say gjava I mean the java + generics that is going to be released soon not GJava.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2004
Added on Dec 23 2003
6 comments
218 views