Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CFEqual, CFDictionaryRef.ByReference, CFStringRef.ByReference to CoreFoundation #1433

Merged
merged 2 commits into from May 7, 2022

Conversation

shalupov
Copy link
Contributor

@shalupov shalupov commented May 5, 2022

No description provided.

@shalupov
Copy link
Contributor Author

shalupov commented May 5, 2022

macos-latest failure is unrelated, looks like com.sun.jna.platform.mac.XAttrUtilTest#testWriteAlignedCliTool is blinking

Copy link
Contributor

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comments inline.

I'm also thinking there's a potential to implement the ByReference bits at the CFTypeRef level, with a CFTypeRef return type and an internal conditional return type based on the CFType: in this case, there's no exception, and the user can just cast the return to use it. See Advapi32Util.registryGetValue() and Cfgmgr32Util.CM_Get_DevNode_Registry_Property() for examples.

@shalupov
Copy link
Contributor Author

shalupov commented May 7, 2022

If we actually want to write type-safe code, IMHO casting types is no-go. It is, however, possible to write typed code if we remove the parameter-less constructor: https://gist.github.com/shalupov/31c53bbdff73a412662507ef19383973

downsides: clunky management of value factories and type-checking at setValue

@shalupov shalupov requested a review from dbwiddis May 7, 2022 16:15
Copy link
Contributor

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, looks good from here!

@dbwiddis dbwiddis merged commit 19c66f3 into java-native-access:master May 7, 2022
shalupov added a commit to shalupov/jna that referenced this pull request May 7, 2022
shalupov added a commit to shalupov/jna that referenced this pull request May 7, 2022
dbwiddis pushed a commit that referenced this pull request May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants