> Crouchez wrote On 09/05/07 13:21,:
>> What is this with javac -Xlint??
[quoted text clipped - 5 lines]
>
> http://java.sun.com/docs/books/tutorial/java/generics/index.html
I'm trying to stay away from Generics. Is it really worth that extra coding
effort? It makes you're code look ugly as well.
Joshua Cranmer - 05 Sep 2007 21:50 GMT
>> Crouchez wrote On 09/05/07 13:21,:
>>> What is this with javac -Xlint??
[quoted text clipped - 7 lines]
> I'm trying to stay away from Generics. Is it really worth that extra coding
> effort? It makes you're code look ugly as well.
For the cost of "ugly" code (C++ templates can go much uglier), you get
compile-time errors instead of runtime errors for some parts of your
code, most notably in the Collections interface. Unless you are doing
awkward tricks or pushing the edges of generics, generics might save you
some significant debugging time...

Signature
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Eric Sosman - 05 Sep 2007 22:55 GMT
Crouchez wrote On 09/05/07 15:15,:
>>Crouchez wrote On 09/05/07 13:21,:
>>
[quoted text clipped - 9 lines]
> I'm trying to stay away from Generics. Is it really worth that extra coding
> effort? It makes you're code look ugly as well.
Aesthetics aside, your attempt to stay away from
generics has already failed: The Collection framework
has been generified, and the warning message you've
received means your code hasn't kept pace. As I see
it, you have various possible recourses:
- Revert to a pre-1.5 Java environment. This will
become untenable when 1.4 reaches end-of-life,
which (IIRC) will be before the USA elects its
next President.
- Add annotations (another 1.5 feature; see the
Tutorial) to suppress the warnings. This will
require extra caution on your part, because a
ClassCastException will make you look reckless
instead of just unfortunate.
- Get rid of -Xlint and ignore the warnings that
still remain. See above.
- Adopt generics in your own code, at least to
the extent of catering to them in other classes
that are already generified. Who knows? You
might grow accustomed to them, even if they
never arouse your adoration.
The choice isn't mine to make.

Signature
Eric.Sosman@sun.com
Lew - 05 Sep 2007 23:18 GMT
> - Revert to a pre-1.5 Java environment. This will
> become untenable when 1.4 reaches end-of-life,
> which (IIRC) will be before the USA elects its
> next President.
It's already moribund:
<http://java.sun.com/j2se/1.4.2/>:
> J2SE 1.4.2 has begun the Sun End of Life (EOL) process. The EOL transition period is from Dec, 11 2006, until the General Availability (GA) of the next Java version, Java SE 7, currently planned for the summer of 2008. With this notice, customers are strongly encouraged to migrate to the current release, Java SE 6.
The USA has undoubtedly "elected" its next President, only the people there
haven't been told who they voted for yet. They should really let the
Electoral College do its representative thing.

Signature
Lew
Roedy Green - 06 Sep 2007 05:29 GMT
On Wed, 05 Sep 2007 19:15:34 GMT, "Crouchez"
<blah@bllllllahblllbllahblahblahhh.com> wrote, quoted or indirectly
quoted someone who said :
>I'm trying to stay away from Generics. Is it really worth that extra coding
>effort? It makes you're code look ugly as well.
Agreed, the generics syntax is barf-inducing, particularly when you
get into < > nests, however, for a simple HashMap<String,Integer> it
is invaluable documentation and will flush out all kinds of bugs. It
also gets rid of explicit casts. This is a good thing. You should
only specify the type in one place. Java generics have it down to two.

Signature
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com