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

Java inheritance is missing #1653

Open
stuartmorgan opened this issue Oct 11, 2024 · 6 comments
Open

Java inheritance is missing #1653

stuartmorgan opened this issue Oct 11, 2024 · 6 comments

Comments

@stuartmorgan
Copy link

stuartmorgan commented Oct 11, 2024

I'm running jnigen on public interface ExoPlayer extends Player {...} The resulting Dart object is class ExoPlayer extends _$jni.JObject {...}, with none of the methods from Player.

I thought the problem was that I wasn't generating Player, so I added that to my config (although I would have filed that as an issue if that were it; this should Just Work IMO), but it didn't help; I have the Player class now too, but ExoPlayer is still just class ExoPlayer extends _$jni.JObject and didn't get any new methods.

@HosseinYousefi
Copy link
Member

HosseinYousefi commented Oct 11, 2024

Will be solved by: #577. I will prioritize this.

but ExoPlayer is still just class ExoPlayer extends _$jni.JObject and didn't get any new methods.

This technically shouldn't be, will investigate.

@stuartmorgan
Copy link
Author

This technically shouldn't be, will investigate.

Yes, I saw class inheritance in your prototype, so I was confused by it not being in mine. I wasn't sure if I was doing something non-obviously wrong, or it was something that was implemented on a branch.

@stuartmorgan
Copy link
Author

FYI I'm not blocked on this; I just made a helper to Java-cast to the superclass. This is definitely an important use case to have working, but no need to change any short-term work planning on my account.

@HosseinYousefi
Copy link
Member

HosseinYousefi commented Oct 11, 2024

Yes, I saw class inheritance in your prototype, so I was confused by it not being in mine. I wasn't sure if I was doing something non-obviously wrong, or it was something that was implemented on a branch.

I think I know why this happened. Probably extends for interfaces is equivalent to implements and we only use extends for inheritance.

@HosseinYousefi
Copy link
Member

I just made a helper to Java-cast to the superclass.

Possible to do exoPlayer.as(Player.type) in Dart to cast as well.

@stuartmorgan
Copy link
Author

stuartmorgan commented Oct 11, 2024

Yes, that's what I meant by Java-cast, sorry for the confusing terminology. The helper I was referring to is a Dart helper because I need to do this constantly in the code, because most of the methods are on the superclass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants