RFR: 2557: Set resolution to Fixed when resolving Jira issues [v3]

Erik Joelsson erikj at openjdk.org
Fri Aug 15 19:49:39 UTC 2025


On Fri, 15 Aug 2025 17:37:41 GMT, Zhao Song <zsong at openjdk.org> wrote:

>> issuetracker/src/main/java/org/openjdk/skara/issuetracker/jira/JiraIssue.java line 248:
>> 
>>> 246: 
>>> 247:     private void performTransition(JiraIssueState state) {
>>> 248:         var id = availableTransitions.get(state.name());
>> 
>> I think either get both state and transition id as parameters, or supply the availableTransitions map as a parameter. I don't think we should store it as a field.
>
> Is there any reason that we can't store it as field?

I agree that in this particular case, a field would work fine, but in general it's a more brittle solution that I would like to avoid when possible. Storing state in an object creates potential opportunities for races, and forces you to have to think about side effects when calling a method that modifies fields.

In this case it could be argued that the field just acts like a cache, but there aren't enough opportunities for hitting the cache that couldn't easily be solved without a field (since the only user would be a private method that is only called from one other method anyway). If we wanted to cache this value, I would be more comfortable if there was a method to call that handled the caching mechanism in a single place. Something like `availableTransitions(boolean useCachedValue)`, but as I said, I think it's overkill here.

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

PR Review Comment: https://git.openjdk.org/skara/pull/1730#discussion_r2279765811


More information about the skara-dev mailing list