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

Add no-argument constructor in case of ambiguous overload #123

Closed
jwharm opened this issue Aug 28, 2024 · 0 comments
Closed

Add no-argument constructor in case of ambiguous overload #123

jwharm opened this issue Aug 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@jwharm
Copy link
Owner

jwharm commented Aug 28, 2024

For example: a new Gtk Frame can be constructed with:

public Frame(@Nullable String label)

The label argument is optional, and will often be null. However, because all Java-GI classes contain a constructor with a single MemorySegment argument, the null argument must be explicitly cast to String like this:

var frame = new Frame((String) null);

or for example in Scala:

val frame = Frame(null.asInstanceOf[String])

This can be resolved by generating an extra constructor in this case, that simply calls this((String) null);

@jwharm jwharm added the enhancement New feature or request label Aug 28, 2024
@jwharm jwharm closed this as completed in c05984b Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant