Some generic changes to have an error free IDE with Java 8.

I changed my Eclipse IDE to JDK 8 and had some issues with generics. If others also have this issues, here is a generics fix for it.