SF/JavaOne, Day 3, JavaGenericsWhaaaa?!

I'm at the Java Collections talk and they're bringing up the issue of
type safety with generics in java 1.5.  The speaker just told me
somethign that sent a shiver up my spine.  Let's say you compiled
the following code in java1.4:

class Old {

    static void addIntegerToList(List list) {

        list.Add(new Integer(42));

    }

}

then in java1.5 you write and compile the following code:

class New {

    static void Foo() {

        List<String> strings = new ArrayList<String>();

        Old.addIntegerToList(strings);

        Srting firstString = strings.getAt(0);

    }

}

Then the above code compiles fine without a single warning!  Ack!

Double-ack!

Ack*Ack*Ack!

The compiler will make you think that everything is typesafe and you
won't know that anything is wrong with your type system until it blows
up at runtime.