Wed Mar 10 22:31:00 GMT 2004
Per> One important question: can we map Java generic classes into C++
Per> generic classes in gcjh? How should we handle generic classes
Per> in gcjh?
I suspect we should just ignore the genericity. Java generics don't
really work like C++ templates. In C++ you instantiate the template
for each set of parameters. In Java you emit a single implementation
for a template by doing erasure on the parameterized types. So for
instance in my earlier message, something like `class Base<T>' emerges
from code generation as (basically) `class Base<Object>'.
There's a lot here I don't know, however. For instance, I don't know
what reflection returns when you ask about parameterized types.
Perhaps it just returns the raw type.
Other factors are our goals for CNI and what the g++ maintainers will
let us put into g++.
More information about the Java