Skip to content

Builders reject an explicitly empty feature set #30

@nficano

Description

@nficano

ArcpRuntime.Builder.features and ArcpClient.Builder.features both call EnumSet.copyOf(features), at arcp-runtime/src/main/java/dev/arcp/runtime/ArcpRuntime.java line 247 and arcp-client/src/main/java/dev/arcp/client/ArcpClient.java line 539. EnumSet.copyOf(Collection) throws IllegalArgumentException for an empty non-EnumSet collection because it cannot infer the enum type. A caller should be able to advertise no optional features by passing Set.of(), but that currently crashes during configuration.

Fix prompt: Add a small helper that returns EnumSet.noneOf(Feature.class) when the supplied feature set is empty and EnumSet.copyOf(features) otherwise. Use it in both builders and anywhere else feature collections are copied into EnumSet. Add unit tests for ArcpRuntime.builder().features(Set.of()).build() and ArcpClient.builder(transport).features(Set.of()).build(), verifying the resulting advertised or requested capabilities are empty rather than throwing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingseverity:mediumMedium severity

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions