Make sure that `owners` are JDK8 compatible in `stable-3.4`

When `owners` plugin is compiled with JDK8 it fails with the following
errors:

plugins/owners/src/main/java/com/googlesource/gerrit/owners/restapi/GetFilesOwners.java:104: error: cannot find symbol
        projectCache.get(change.getProject()).stream()
                                             ^
  symbol:   method stream()
  location: class Optional<ProjectState>

plugins/owners/src/main/java/com/googlesource/gerrit/owners/restapi/GetFilesOwners.java:129: error: invalid method reference
                      .flatMap(Optional::stream)
                               ^
  cannot find symbol
    symbol:   method stream()
    location: class Optional

It is due to the fact that JDK8 has no Optional.stream function.
Per javadoc, it was added in JDK9.

Replace calls to `Optional.stream` with `map` to make JKD8 compiler
happy.

Change-Id: I318403910edf3d23a3c06dd92bf10e005ca26b70
diff --git a/owners/src/main/java/com/googlesource/gerrit/owners/restapi/GetFilesOwners.java b/owners/src/main/java/com/googlesource/gerrit/owners/restapi/GetFilesOwners.java
index 9030bfc..04c6395 100644
--- a/owners/src/main/java/com/googlesource/gerrit/owners/restapi/GetFilesOwners.java
+++ b/owners/src/main/java/com/googlesource/gerrit/owners/restapi/GetFilesOwners.java
@@ -52,6 +52,7 @@
 import java.util.Optional;
 import java.util.Set;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import org.eclipse.jgit.lib.Repository;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -101,7 +102,10 @@
     int id = revision.getChangeResource().getChange().getChangeId();
 
     List<Project.NameKey> projectParents =
-        projectCache.get(change.getProject()).stream()
+        projectCache
+            .get(change.getProject())
+            .map(Stream::of)
+            .orElse(Stream.empty())
             .flatMap(s -> s.parents().stream())
             .map(ProjectState::getNameKey)
             .collect(Collectors.toList());
@@ -126,7 +130,7 @@
               ids ->
                   ids.stream()
                       .map(this::getOwnerFromAccountId)
-                      .flatMap(Optional::stream)
+                      .flatMap(owner -> owner.map(Stream::of).orElse(Stream.empty()))
                       .collect(Collectors.toSet()));
 
       Map<String, Set<GroupOwner>> fileToOwners =