Set path to null after filling the comment context

In CommentJson, we format comments as a map
{key = file path, value = list of comment entities}.

With this representation, we set the path inside the comment entity to
null (redundant information). Since the comment context data was filled
after setting the path to null, creating the comment context AutoValue
failed with NPE for the required "path" field.

With this change, I moved setting the path to null after retrieving the
comment context.

Change-Id: I0b36ba63c05b6376f8aca001a3d380183d33131d
diff --git a/java/com/google/gerrit/server/restapi/change/CommentJson.java b/java/com/google/gerrit/server/restapi/change/CommentJson.java
index cc8ad47..02f39ab 100644
--- a/java/com/google/gerrit/server/restapi/change/CommentJson.java
+++ b/java/com/google/gerrit/server/restapi/change/CommentJson.java
@@ -123,7 +123,6 @@
           list = new ArrayList<>();
           out.put(o.path, list);
         }
-        o.path = null;
         list.add(o);
       }
 
@@ -133,10 +132,11 @@
         loader.fill();
       }
 
+      List<T> allComments = out.values().stream().flatMap(Collection::stream).collect(toList());
       if (fillCommentContext) {
-        List<T> allComments = out.values().stream().flatMap(Collection::stream).collect(toList());
         addCommentContext(allComments);
       }
+      allComments.forEach(c -> c.path = null); // we don't need path since it exists in the map keys
       return out;
     }