What is the meaning of type safety warning in some Java generic casts?

What is the meaning of the Java warning?

Type safety: The cast from Object to List<Integer> is actually checking against the erased type List

I get this warning when I try to cast an Object to a type with generic information, such as in the following code:

Object object = getMyList();
List<Integer> list = (List<Integer>) object;
This question and all comments follow the "Attribution Required."

All Answers

Answers Loading...
Leave a Reply
You must be logged in to post a answer.