In chapter 7 page 602/603 in K&B, it explains that for legacy code to work, the compiler will allow you to put anything into a collection but will generate a warning. Why is the following example producing an error instead of a warning.
This would generate a compiler warning about raw types, but you'd be allowed to put anything into the list as you describe.
An important thing to understand about generics in Java is they are only applied at compile time. The types running in the JVM would still look like the legacy code above. Since you specify the type of the list, the compiler enforces what you can put into it, e.g. a String "is not" an AnimalA. The compiler will automatically change the code above to which would allow you to put the String in there since String "is a" Object.
Everything is theoretically impossible, until it is done. ~Robert A. Heinlein
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com