Make the code build on Java 8 Gerrit v3.4 technically still supports Java 8 and the code should be compatible with it. Remove some avoidable Java 11 specific constructs and use the equivalents in Java 8. Change-Id: I0ca7e1d1a2b0bd3b7aa004e887c0e626b346d127