How to Avoid Generics Related Warnings in Eclipse

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 should be parameterized
  • Type safety: The method put(Object, Object) belongs to the raw type Map. References to generic type Map 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):

Skip eclipse warnings generated by generics


  1. Thanks a lot buddy. This has resolved a long pending issue for us. We were looking to remove the generics related warning messages that were coming while using checkstyle as we couldnt eliminate them due to the massive amount of code changes that would be required for the same. Now we can do it in a phase wise manner.

    Thanks Again

Leave a Comment.