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
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java index ffd3c1f..c61d4d9 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/auth/PullReplicationGroupBackend.java
@@ -28,7 +28,6 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.List; /** Backend to expose the pull-replication internal user group membership. */ @Singleton @@ -84,7 +83,7 @@ @Override public Collection<GroupReference> suggest(String name, ProjectState project) { return NAME_PREFIX.contains(name.toLowerCase()) - ? List.of(GroupReference.create(INTERNAL_GROUP_UUID, INTERNAL_GROUP_NAME)) + ? Arrays.asList(GroupReference.create(INTERNAL_GROUP_UUID, INTERNAL_GROUP_NAME)) : Collections.emptyList(); }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/InexistentRefTransportException.java b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/InexistentRefTransportException.java index 7c2e637..f97f648 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/InexistentRefTransportException.java +++ b/src/main/java/com/googlesource/gerrit/plugins/replication/pull/fetch/InexistentRefTransportException.java
@@ -40,8 +40,11 @@ } public static Optional<TransportException> getOptionalPermanentFailure(TransportException e) { - return wrapException(JGIT_INEXISTENT_REF_PATTERN, e) - .or(() -> wrapException(CGIT_INEXISTENT_REF_PATTERN, e)); + Optional<TransportException> jgitEx = wrapException(JGIT_INEXISTENT_REF_PATTERN, e); + if (jgitEx.isPresent()) { + return jgitEx; + } + return wrapException(CGIT_INEXISTENT_REF_PATTERN, e); } private static Optional<TransportException> wrapException(