java-native-access / java-native-access/jna

Advapi32Util.registryGetStringValue Javadoc says only REG_SZ values are allowed, but implementation also allows REG_EXPAND_SZ

Open
#1,513 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
8.9k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

The Javadoc of Advapi32Util.registryGetStringValue()
https://github.com/java-native-access/jna/blob/e96f30192e9455e7cc4117cce06fc3fa80bead55/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java#LL754C32-L754C32
says

Get a registry REG_SZ value.,

however the implementation
https://github.com/java-native-access/jna/blob/e96f30192e9455e7cc4117cce06fc3fa80bead55/contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java#LL772C52-L772C52
also returns the value if its type is

REG_EXPAND_SZ.

My expectation was that REG_EXPAND_SZ would be rejected for symmetry reasons:

  • #registrySetStringValue() <- REG_SZ
  • #registryGetStringValue() -> REG_SZ / REG_EXPAND_SZ
  • #registrySetExpandableStringValue() <- REG_EXPAND_SZ
  • #registryGetExpandableStringValue() -> REG_EXPAND_SZ

Is the implementation incorrect or is this the expected behavior and the Javadoc should be adjusted?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read contrib/platform/src/com/sun/jna/platform/win32/Advapi32Util.java around registryGetStringValue(), registrySetStringValue(), and registryGetExpandableStringValue(). Determine whether REG_EXPAND_SZ is intended to be accepted, then align the Javadoc or implementation with that contract. Done means the documented behavior and the registry value handling agree.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
operating-systems
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.