A bunch of cleanups for compiler warnings

This goes through the Java compiler warnings and cleans up most of the ones that aren't in test code, using Java 8.