Fixes #5657: make tests compile with Java 8