Java8 build fixes

Minimum changes required to build and run tests using latest Java8 JDK.