I know why I am getting the warning(i.e assigning raw type to parameterized type), but I don't exactly get what will be possible sequences if I ignore the warning.
List list = new ArrayList();
List<Integer> iList = list; // warning: unchecked conversion
The (only) runtime consequence is code failing due to
ClassCastException's, either directly or indirectly1.The other consequence is that you allow errors that should be detected and corrected at compile time to proceed into test, and maybe production where the costs and consequences may be significantly worse.
While ignoring these warnings is a bad idea, suppressing them incorrectly can be worse.
I mean adding a
@SuppressWarningannotation for a warning that actually will result in a runtime exception or another (real) problem. Adding a@SuppressWarningannotation just to make the compiler "shut up" is a dangerous habit.1 - For instance, if you caught and incorrectly squashed a
ClassCastException!