Skip to content

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

Merged
dbwiddis merged 2 commits intojava-native-access:masterfrom
shalupov:sh/by-ref
May 7, 2022
Merged

Add CFEqual, CFDictionaryRef.ByReference, CFStringRef.ByReference to CoreFoundation#1433
dbwiddis merged 2 commits intojava-native-access:masterfrom
shalupov:sh/by-ref

Conversation

@shalupov
Copy link
Copy Markdown
Contributor

@shalupov shalupov commented May 5, 2022

No description provided.

@shalupov
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java
Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java Outdated
Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java Outdated
Comment thread contrib/platform/src/com/sun/jna/platform/mac/CoreFoundation.java
@shalupov
Copy link
Copy Markdown
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
Copy Markdown
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.

2 participants