Since pojo not declared as generic
POJO pojo = new POJO();
the compiler assumes that you are using it in pre-code. those. when the generic files were added after writing the code. Therefore when you do
List<String> integer = pojo.getInteger();
You get a warning, not an error.
i.e. If the type is not generic, all generic checks are disabled, not just those of the type that you did not give it. I believe this is for maximum backward compatibility.
For comparison.
Map mapOfInteger = new Map();
In this example, you can expect Set<Entry<K, V>> become Set<Entry> if it is not generic, but the compiler returns to consider a class that is not generic Set .
Peter Lawrey
source share