How to Avoid Generics Related Warnings in Eclipse

admin  

I get tones of exceptions in my code because I tend to use Generics in the old-fashioned way. I have my reasons for that. And I have tons of warnings like those:

  • HashMap is a raw type. References to generic type HashMap<K,V> should be parameterized
  • Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map<K,V> should be parameterized

Just because I use to write code like this in java 1.5:

Map parametersMap = new HashMap();
parametersMap.put(properties.get("input.key"), page);

I decided to say, no I don't want to see them again. You can change the Project Properties in eclipse to ignore them: Right Click on the Project > Java Compiler > Errors / Warnings like in the snapshot (notice you can change this setting only for your specific project or for entire workspace):