...
It relies on clients to externally synchronize the object and states so its thread-unsafe behavior in the documentation. However, there is no guarantee that all unrelated (trusted or untrusted) clients will do follow this advice.
Compliant Solution
This compliant solution internally synchronizes the counter
field and does not depend on any external synchronization.
...