java-native-access / java-native-access/jna
Unsafe increment of static field
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 8.9k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
Mutable static fields should be synchronised to ensure safe publication.
There is no guarantee that the following code will generate unique names:
The messageLoopId variable should probably be replaced by an AtomicLong.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in contrib/platform/src/com/sun/jna/platform/win32/User32Util.java around lines 166-170 and inspect how messageLoopId is incremented and used. Confirm the change preserves unique message names under concurrent access; done means the static counter is safely synchronized or atomic.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100