This is generic programming?
From: James Moughan (moughanj_at_tcd.ie)
Date: 04/27/04
- Next message: Raymond DeCampo: "Re: javadoc and {@inheritDoc}"
- Previous message: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 Apr 2004 15:12:14 -0700
Lots of nice sugar in the 1.5 beta, but what's going on, exactly, with
generics?
e.g.
static <T> void aMethod(T t){
t.add(5);
}
returns
cannot find symbol
symbol : method add(int)
location: class java.lang.Object
t.add(5); ^^^^^^^^^^^^^^^^
?!?
This is in a class which doesn't even call the method; as I understand
the concept javac shouldn't have enough info to even try to compile
it, let alone resolve it to Object.
It looks like what's going on here is a bunch of 'smart' casting, not
any sort of template system. Seems we're not going to be exposed to
anything truly powerful.
And since Templates apparently don't extend to primitives it's not
going to allow any Java native compilers to begin approaching c++ in
terms of speed, which it probably could have done with some careful
work.
Shame, because the syntax is definitely nicer than in c++.
- Next message: Raymond DeCampo: "Re: javadoc and {@inheritDoc}"
- Previous message: Douglas A. Gwyn: "Re: Cracking DES with C++ is faster than Java?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]