Skip to content

Allow access to base interfaces via ProxyObject and improve binding#616

Merged
dblock merged 3 commits intojava-native-access:masterfrom
matthiasblaesing:c.s.j.p.w.COM.util_access_IDispatch
Mar 26, 2016
Merged

Allow access to base interfaces via ProxyObject and improve binding#616
dblock merged 3 commits intojava-native-access:masterfrom
matthiasblaesing:c.s.j.p.w.COM.util_access_IDispatch

Conversation

@matthiasblaesing
Copy link
Copy Markdown
Member

The ProxyObject implements several base interfaces directly, but the methods were not correctly handled. This pull modifies the InvocationHandler part to select methods based on declaration interface with direct method invocation, instead of manually redirecting each method.

The second part adds more robustness (and speed as sideeffect) to ProxyObject by using dispIDs if they are available, making reflection via GetIDsByName unnessary.

Although the ProxyObject by definition exposes a IDispatch, the methods
are not callable via the Proxy.
…etIDsOfNames)

dispIDs can be queried via GetIDsOfNames at runtime or retrieved from the
typelibrary when bindings are generated.

Using the dispID eliminates one additional call into native environment.

It was also observed, that runtime reflection sometimes retrieves wrong
values (toString on IHTMLDocument2), so using a previously retrieved value
seems to be saver.
@matthiasblaesing matthiasblaesing force-pushed the c.s.j.p.w.COM.util_access_IDispatch branch from 1714d29 to b57fe09 Compare March 11, 2016 20:50
Comment thread CHANGES.md Outdated
* [#608](https://github.com/java-native-access/jna/pull/608): Mavenize the build process - change parent and native pom artifactId/name to differentiate in IDE and build tools. [@bhamail](https://github.com/bhamail)
* [#613](https://github.com/java-native-access/jna/pull/613): Make Win32Exception extend LastErrorException [@lgoldstein](https://github.com/lgoldstein).
* [#613](https://github.com/java-native-access/jna/pull/614): Added standard 'Kernel32Util#closeHandle' method that throws a Win32Exception if failed to close the handle [@lgoldstein](https://github.com/lgoldstein).
* [#616](https://github.com/java-native-access/jna/pull/616): Allow access to base interfaces (most important IDispatch) via ProxyObject and improve binding by allowing to use dispId for the call [@matthiasblaesing](https://github.com/matthiasblaesing)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing period at the end ;)

@dblock
Copy link
Copy Markdown
Member

dblock commented Mar 13, 2016

This looks ok to me, maybe @lgoldstein could help with a more thorough CR, I don't understand half the code ;)

@matthiasblaesing matthiasblaesing force-pushed the c.s.j.p.w.COM.util_access_IDispatch branch from b57fe09 to a1bee93 Compare March 25, 2016 22:14
@matthiasblaesing
Copy link
Copy Markdown
Member Author

The CHANGES.md entry was adjusted - is there any way I can help with review?

@dblock
Copy link
Copy Markdown
Member

dblock commented Mar 26, 2016

I'll mege.

@dblock dblock merged commit 2c6d9e8 into java-native-access:master Mar 26, 2016
@matthiasblaesing matthiasblaesing deleted the c.s.j.p.w.COM.util_access_IDispatch branch March 30, 2016 20:06
mstyura pushed a commit to mstyura/jna that referenced this pull request Sep 9, 2024
Motivation:

We should use the same order of method arguments to not introduce bugs
later.

Modifications:

Change argument order to be consistent and fix a typo

Result:

Cleanup
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