RFR: 1256: Provide a common method to get the corresponding csr issue

Guoxiong Li gli at openjdk.java.net
Tue Nov 30 15:21:45 UTC 2021

On Tue, 30 Nov 2021 14:49:27 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> Hi all,
>> This patch adds the common methods `Issue#linksWithRelationships`, `Issue#csrLink` and `Issue#csrIssue` and refactors the code to reduce the loop nested statements by using these common methods.
>> All the existing tests passed.
>> Best Regards,
>> -- Guoxiong
> I'm not sure about this change. The Issue interface seems over used and already contains a bunch of methods that do not apply to several implementors. I don't like the idea of adding even more such methods.
> I think we need to try to extract a sub interface from Issue, which is specialized for bugtrackers or Jira or something. Not sure what to name it at this point though. All the links  methods should be moved there, and methods that definitely can't return a pull request, like IssueProject::issue should return the new interface instead. This is part of what I meant with this being hard to solve properly.

@erikj79 Thanks for the comment.

>From your suggestion in the code, I find that we don't need these 3 method to write the clean code. We can only use the stream api to simply the nest loop statement, which is more flexible.

It seems we need a method named `linksWithRelationships`, which contains a loop statement, to find the needed links. But actually, if we use the stream api, we only need a simple invoking statement.

I would like remove these three method and use the stream api to refactor the code.
And this issue title may change to `Use stream api to simplify the csr issue lookup`.


PR: https://git.openjdk.java.net/skara/pull/1248

More information about the skara-dev mailing list