Fix compilation with target=8
(Type inference is too smart for JDK8 and generic type checking is too strict)