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
- Change all return types from
ArrayList<String> to List<String>.
- 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
Summary
LabelUtilexposes severalpublic static synchronizedmethods that returnArrayList<String>— the concrete mutable type rather than theList<String>interface. Additionally,getInformationModelVersions()returns the live static backing list without a defensive copy, so a caller could mutate shared state even while thesynchronizedgetter is protecting the read.Affected methods
getInformationModelVersions()(~line 177) — returns live staticArrayList; callers can mutate between synchronized callsgetIdentifiersCommon(...)overloads (~lines 268, 273, 286)getLidVidReferences(...)overloads (~lines 384, 388, 398)getLogicalIdentifiers(...)overloads (~lines 443, 447)Recommended fix
ArrayList<String>toList<String>.getInformationModelVersions()specifically, returnCollections.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