I am working with an old Java application written for Java 1.4 before Generics were available. Since then, we have completed the upgrade to Java 6.
We are now exploring the possibility of making changes to Generics support in our collections in order to ensure compile-time security, as well as to preserve the intelligence of the developer.
Are there any warnings or errors that we should be aware of when performing this update?
@SuppressWarning("unchecked")
...
, IMHO, , , , , , List<Animal> <> List<Tiger> ... , ? .
List<Animal> <> List<Tiger>
, / , , , , ? Object 'catch-alls.' , .
- , Hibernate .., , . , ( ).
, , , , , , .
, .
1) Generics - , , ( -). . , , <?> .
<?>
2) , . List<? extends Shape>, List<Shape>. Circle, Shape, List<Circle> List<Shape>, List<? extends Shape>. , , , , .
List<? extends Shape>
List<Shape>
Circle
Shape
List<Circle>
3) , , List List<?> . , (. ). , , , , , , , , .
List
List<?>