Skip to content

java.lang.UnsupportedOperationException FieldDefinition.Builder.inputValueDefinition #2099

@dfa1

Description

@dfa1

Describe the bug
In our codebase we are using FieldDefinition.Builder like:

builder.inputValueDefinition(inputValueDefinition);

with current master (2020-11-10T10-26-00-07ca7ee, commit 07ca7ee) we have:

java.lang.UnsupportedOperationException
at graphql.com.google.common.collect.ImmutableCollection.add(ImmutableCollection.java:246)
at graphql.language.FieldDefinition$Builder.inputValueDefinition(FieldDefinition.java:210)

IMHO the cause is that in the copy constructor we have this:

this.inputValueDefinitions = existing.getInputValueDefinitions();

whereas should be like this:

this.inputValueDefinitions = new ArrayList<>(existing.getInputValueDefinitions());

because it is a builder and it is supposed to be mutable.

To Reproduce

Use of FieldDefinition.Builder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions