private Map<String,Map<Integer,Integer>> mapPatchPositionsToLines(GHPullRequest pr) throws IOException {
  Map<String,Map<Integer,Integer>> result=new HashMap<>();
  for (  GHPullRequestFileDetail file : pr.listFiles()) {
    Map<Integer,Integer> patchLocationMapping=new HashMap<>();
    result.put(file.getFilename(),patchLocationMapping);
    if (config.tryReportIssuesInline()) {
      String patch=file.getPatch();
      if (patch == null) {
        continue;
      }
      processPatch(patchLocationMapping,patch);
    }
  }
  return result;
}

private Map < String , Map < Integer , Integer > > mapPatchPositionsToLines ( GHPullRequest pr ) throws IOException { Map < String , Map < Integer , Integer > > result = new HashMap < > ( ) ; for ( GHPullRequestFileDetail file : pr . listFiles ( ) ) { Map < Integer , Integer > patchLocationMapping = new HashMap < > ( ) ; result . put ( file . getFilename ( ) , patchLocationMapping ) ; if ( config . tryReportIssuesInline ( ) ) { String patch = file . getPatch ( ) ; if ( patch == null ) { continue ; } processPatch ( patchLocationMapping , patch ) ; } } return result ; }
github expect review comments to be added on " patch lines " ( aka position ) but not on file lines . so we have to iterate over each patch and compute corresponding file line in order to later map issues to the correct position .
