Fix incompatibilities with JDK 8.

Reviewed at https://reviews.apache.org/r/19391/