Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes not always working com4j event handling. There are 2 issues fixed.
First is caused by a possible camelize of method names on event interface code generation. The camelize action is compliant with Java method naming conventions but native callback into EventProxy is not aware of such renaming of methods and fails to find the DISPID by name. To solve that a new annotation DISPNAME was introduced for storing the original method name. The EventInterfaceGenerator adds this annotation now to event methods besides the existing DISPID annotation. For keeping compatibility with existing code at runtime the DISPNAME is not mandatory for EventMethods. The EventInterfaceDescriptor uses the DISPNAME value (if present) or the Java method name (previous behavior) as key to fill the methodByName map.
The second is caused by a ComException on event method invoke and an arguments Variant.convertTo error. The exception is causing the JVM to crash with a access violation. To avoid that the event method args convertTo is wrapped by a try-catch now.