Skip to content

ArcpRuntime.advertised exposes mutable internal state #31

Description

@nficano

ArcpRuntime.advertised returns the runtime's internal Set directly at arcp-runtime/src/main/java/dev/arcp/runtime/ArcpRuntime.java around line 128. The field is an EnumSet created during construction, so any caller can mutate runtime.advertised() and change future capability negotiation after the runtime has been built. Other public APIs generally use immutable copies, so this accessor is inconsistent with the SDK's immutable data-carrier style.

Fix prompt: Store advertised as an immutable Set.copyOf or return Collections.unmodifiableSet(advertised) from the accessor. Prefer making the field itself immutable so internal code cannot accidentally mutate it later. Add a regression test that attempts to mutate runtime.advertised() and verifies it throws UnsupportedOperationException or otherwise cannot alter the runtime's advertised feature set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    code-qualityCode quality, maintainability, and API designseverity:mediumMedium severity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions