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

Accessing a JavaResource from a KotlinResource #707

Open
kylepl opened this issue Sep 17, 2024 · 6 comments
Open

Accessing a JavaResource from a KotlinResource #707

kylepl opened this issue Sep 17, 2024 · 6 comments

Comments

@kylepl
Copy link

kylepl commented Sep 17, 2024

Sometime I fallback to using just the Java bindings, but have specified say the provider in the Kotlin side. I tried to extract a JavaProviderResource from a KotlinProviderResource - but it is protected (so I had to patch locally, and start generating more things locally).

My local path is just modifying

internal abstract val underlyingJavaResource: JavaResource
to be public instead of internal.

So two questions:

  • Is there already a way to extract the JavaResource from the KotlinResource?
  • If not, thoughts on having it? Seems useful.
@jplewa
Copy link
Member

jplewa commented Sep 17, 2024 via email

@kylepl
Copy link
Author

kylepl commented Sep 17, 2024

#706 is a good example of needing to fallback to the Java bindings, and wanting to re-use my existing Kotlin logic.

@jplewa
Copy link
Member

jplewa commented Sep 17, 2024

#706 is a good example of needing to fallback to the Java bindings, and wanting to re-use my existing Kotlin logic.

Yes, but in this case there's no corresponding Kotlin classes, so exposing the Java objects wouldn't really be of much help 😅 Do any other examples come to mind?

@kylepl
Copy link
Author

kylepl commented Sep 17, 2024

Definitely possible that I am missing something better, but in the other example I have:

  • a Kubernetes (Kotlin) provider
  • I use it with Kotlin-generated bindings, works fine.
  • CustomResource does not exist, thus I need to use the Java bindings
  • The Java CustomResource needs a JavaProvider, and rather than figuring out how to generate that directly, I instead want to make use of my Kubernetes Kotlin provider
  • For my local version, I expose the underlying Java object, which lets me use the mix of Java and Kotlin

@jplewa
Copy link
Member

jplewa commented Sep 17, 2024

Ah, I understand, good point. I'll try to figure out how to handle these overlay resources when I get the chance, thank you for your patience 🙏

@kylepl
Copy link
Author

kylepl commented Sep 17, 2024

Sounds good, no rush though, I'm unblocked.

And I empathize with the desire to both hide implementation details and also the occasional need for escape hatches. 😅

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