Skip to content

Refactor: LabelUtil public methods should return List<String> not ArrayList<String> #1617

Description

@jordanpadams

Summary

LabelUtil exposes several public static synchronized methods that return ArrayList<String> — the concrete mutable type rather than the List<String> interface. Additionally, getInformationModelVersions() returns the live static backing list without a defensive copy, so a caller could mutate shared state even while the synchronized getter is protecting the read.

Affected methods

  • getInformationModelVersions() (~line 177) — returns live static ArrayList; callers can mutate between synchronized calls
  • getIdentifiersCommon(...) overloads (~lines 268, 273, 286)
  • getLidVidReferences(...) overloads (~lines 384, 388, 398)
  • getLogicalIdentifiers(...) overloads (~lines 443, 447)

Recommended fix

  1. Change all return types from ArrayList<String> to List<String>.
  2. For getInformationModelVersions() specifically, return Collections.unmodifiableList(LabelUtil.informationModelVersions) so callers cannot mutate the backing list between synchronized calls.

Related

Identified during immutability/synchronization audit triggered by PR #1607 review feedback.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    ToDo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions