What is "evil" about casting?

From: Jonck (jonck_at_vanderkogel.net)
Date: 09/29/04


Date: Wed, 29 Sep 2004 14:06:44 GMT

Hi all,
Today I was reading through some discussions about the new functionality
in Java 1.5 and there I read more than once that casting was considered
"evil" and that generics would solve all this (or not, as others argued).

Could someone give me a brief explenation as to what is wrong with
casting and how generics in Java 1.5 will solve this? Personally I don't
see what's wrong with casting, in all the books I've read on Java casts
are used all the time...

Thanks very much, Jonck



Relevant Pages

  • Re: What is "evil" about casting?
    ... > in Java 1.5 and there I read more than once that casting was considered ... > Could someone give me a brief explenation as to what is wrong with ... the more robust Generics syntax. ...
    (comp.lang.java.programmer)
  • Re: Box and UnBoxing
    ... > I assume it's the same as in Java and then it's not similar to casting. ... > Boxing creates a new instance of a different class, ... Shayne Wissler ...
    (comp.object)
  • Re: What is "evil" about casting?
    ... > see what's wrong with casting, in all the books I've read on Java casts ... The problem with casting is that it results in runtime exceptions. ... Generics makes Collections typesafe *and* convenient ...
    (comp.lang.java.programmer)
  • Re: What is "evil" about casting?
    ... > in Java 1.5 and there I read more than once that casting was considered ... They then must cast, ... but they require the developer to know the type of object he ...
    (comp.lang.java.programmer)
  • Re: Array Help!?!?!?...
    ... but I'm sure it can be done somehow, ... possibly by casting it to some generic type. ... Or perhaps that's the Java in ...
    (microsoft.public.word.vba.general)