RFR: 1951: Refactor Issue class hierarchy [v2]

Erik Joelsson erikj at openjdk.org
Wed Jun 21 17:15:38 UTC 2023


On Wed, 21 Jun 2023 09:38:38 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> The class hierarchy around the (org.openjdk.skara.issuetracker.)Issue interface is weird and cumbersome to work with. This interface is representing an Issue as returned from an IssueTracker. It's implemented by `JiraIssue` (and `TestIssue` for testing purposes). It's also extended by `PullRequest`, which makes it awkward to add Jira/bug tracker specific functionality to it since we must then also implement that for all `PullRequest` implementations (usually by just throwing a runtime exception). It's rare to use `Issue` as something that can be either a `PullRequest` or an actual issue, so sharing this interface isn't adding much value.
>> 
>> In addition to this, there is also an unrelated class called Issue (org.openjdk.skara.vcs.openjdk.Issue) in the vcs module. This class just represents the OpenJDK interpretation of an issue in the context of a commit message. These classes are however used together sometimes, which is causing a lot of confusion.
>> 
>> I would like to improve this situation. My proposal is to introduce a new interface `IssueTrackerIssue` which is a sub type of `Issue` that contains methods specific to bug trackers (or at least Jira). In practice right now this is links and properties. The name reflects that this is the kind of issue returned from an `IssueTracker` as opposed to an Issue from just any kind of `Forge`. Having that in an interface enables us to also define a specific test implementation `TestIssueTrackerIssue` that mimics our `JiraIssue` implementation without clashing with `PullRequest` and its implementations. With this new type name, we can also get around the clash when having to deal with the vcs Issue type. This solution retains the shared super interface `Issue` between `IssueTrackerIssue` and `PullRequest`. I'm also refactoring `TestIssue` and its subclasses to reflect this new hierarchy.
>> 
>> The patch is pretty big, which is why I'm doing this in isolation. No functionality should change.
>
> Erik Joelsson has updated the pull request incrementally with one additional commit since the last revision:
> 
>   More copyrights and review comments

Thanks for review!

-------------

PR Comment: https://git.openjdk.org/skara/pull/1534#issuecomment-1601255873


More information about the skara-dev mailing list