Skip to content

NativeLibrary.getOptions allows options to be mutated #1571

@sebbASF

Description

@sebbASF

The getOptions() method returns a pointer to the options Map:

public Map<String, ?> getOptions() {
return options;
}

This means the options can be mutated externally, which may cause unpredictable behaviour.
It also means that the class is not thread-safe, as changes to the options in one thread may not be seen by another.

One solution is to provide a copy of the options (note: this needs to be a deep copy)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions