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)
The getOptions() method returns a pointer to the options Map:
jna/src/com/sun/jna/NativeLibrary.java
Lines 624 to 626 in 3656295
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)