Fix generic usage that caused compile errors on Java 8.

+review REVIEW-5204