RFR: 1951: Refactor Issue class hierarchy [v2]

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

> 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


  - all: https://git.openjdk.org/skara/pull/1534/files
  - new: https://git.openjdk.org/skara/pull/1534/files/6097c019..d1c0fc33

 - full: https://webrevs.openjdk.org/?repo=skara&pr=1534&range=01
 - incr: https://webrevs.openjdk.org/?repo=skara&pr=1534&range=00-01

  Stats: 28 lines in 22 files changed: 0 ins; 8 del; 20 mod
  Patch: https://git.openjdk.org/skara/pull/1534.diff
  Fetch: git fetch https://git.openjdk.org/skara.git pull/1534/head:pull/1534

PR: https://git.openjdk.org/skara/pull/1534

More information about the skara-dev mailing list