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

Extending Java Generic Class in Python #590

Closed
AndreFCruz opened this issue Apr 27, 2021 · 3 comments
Closed

Extending Java Generic Class in Python #590

AndreFCruz opened this issue Apr 27, 2021 · 3 comments
Labels

Comments

@AndreFCruz
Copy link

AndreFCruz commented Apr 27, 2021

I have a Java generic class of the sorts public class Box<T> { ... }

I need to have objects of type Box<Square> in Python.

I'm trying to either

  1. have a python wrapper for this class that I can parameterize with the types I need (so I can get python objects of type Box<Square>)
  2. or extend this java generic class in python, so that I can subclass it with the types I need

How would I do this? Is it even possible?

Thanks

@cmacdonald
Copy link
Contributor

Currently, you cant subclass Java classes in Pyjnius.

@RobertFlatt
Copy link

You have to subclass in Java, then pass Box<Square> in the normal way.

If the case is a Java callback, then a wrapper is always required.
I pointed to an example here #592 (comment)

@github-actions
Copy link

👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project.
Let us know if this comment was made in error, and we'll be happy to reopen the issue.

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

No branches or pull requests

4 participants