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

Return type overrides #81

Merged
merged 2 commits into from
Nov 21, 2023
Merged

Return type overrides #81

merged 2 commits into from
Nov 21, 2023

Conversation

jwharm
Copy link
Owner

@jwharm jwharm commented Nov 21, 2023

In a few situations, we need to override the return type of a method:

  • When a method in a subclass overrides a method in a superclass, with a different return type
  • When an instance method and virtual method in the same class and the same name have differnt return types.

In previous Java-GI versions, the return type would be updated with a patch, but that would also impact the actual call to the native function. That can lead to segfaults. So with this PR, the return type of the Java bindings is changed, but the native function invocation still uses the type signature as declared in the GIR file.

The following return types are changed:

  • void GtkMediaStream.play() returns void, but a virtual method with the same name returns gboolean. The instance method now also returns gboolean (always true).
  • void GstAudioSink.stop() overrides gboolean GstBaseSink.stop(), so it now returns gboolean (always true).
  • void GstVideoOverlay.setRenderRectangle() returns void, but a virtual method with the same name returns gboolean. The instance method now also returns gboolean (always true).
  • void SoupAuthDomain.challenge() returns void, but a virtual method with the same name returns char*. The instance method now also returns char* (always null).

@jwharm jwharm merged commit 7742610 into main Nov 21, 2023
@jwharm jwharm deleted the return-value-overrides branch November 21, 2023 20:44
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.

1 participant