Fix tests failing with java 8 #457 

Compatibility fixes for java 8, see #457.

Note: preliminary version, this is mostly to see whether i found all issuess