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.
Until now, Java-GI generated
public
Java methods for GObject virtual methods. The Java method would lookup the function pointer in the typeclass and invoke it. When also a regular method existed, it would be hidden from the Java API in favor of the virtual method.This is not correct, because GObject virtual methods are not supposed to be treated as the API. The regular methods should be the
public
methods in the Java classes, and the virtual methods should only be available for "chaining up" from an overridden method in a derived class. In other words, virtual methods are supposed to haveprotected
visibility in the Java API.When generating a Java class, the Java-GI bindings generator look for matching pairs of regular methods and virtual methods, with the same name and type signature:
public
visibility. The method invokes the regular C method.protected
visibility. When called, the function pointer of the parent typeclass is invoked.public
visibility. Under normal circumstances, the method invokes the regular C method. When chaining up (withasParent()
), the function pointer of the parent typeclass is invoked. TheasParent()
method itself hasprotected
visibility so this is only exposed to derived types.Virtual methods in an interface are not exposed in the Java bindings, because Java interfaces cannot contain
protected
methods.As a result, a virtual method will never be exposed directly as part of the API. It is, however, available for chaining up, from a method override in a derived class.