Fixed java 8 compilation issues with generics