-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[GR-40198] Provide public API for feature-based JNI / Resource / Proxy / Serialization registration. #4783
Conversation
14d9d84
to
2cd157c
Compare
180912f
to
1e3a5ea
Compare
Yes. If you can help make sure that everything you need is in the first batch, that would speed up the overall migration process for all of us. :)
The migration should happen in a backward compatible way, so we don't plan to move anything just yet. This PR adds a new API to the Native Image part of the GraalVM SDK that frameworks are supposed to use in the future. Everything in |
Yes
Everything that is part of our SVM codebase that currently requires a
As you can see this PR only adds API but does not remove anything. To be on the safe side projects that currently use svm-internal API should switch to using public API only (for example instead of using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello Paul, thanks for initiating this refactoring.
One major package that I see missing from this batch is com.oracle.svm.core.annotate
, not sure if you plan to make it public API in a different PR.
Other than the annotations, Quarkus is currently using the following internal APIs:
com.oracle.svm.core.jdk.UnsupportedFeatureError
to report a more quarkus-friendly errorcom.oracle.svm.core.jdk.Resources#registerResource
com.oracle.svm.util.ReflectionUtil#lookupMethod
com.oracle.svm.core.jni.JNIRuntimeAccess#register
com.oracle.svm.core.jdk.proxy.DynamicProxyRegistry#addProxyClass
com.oracle.svm.core.jdk.localization.LocalizationFeature#prepareBundle
com.oracle.svm.core.configure.ResourcesRegistry#ignoreResources
com.oracle.svm.core.configure.ResourcesRegistry#addResources
com.oracle.svm.hosted.reflect.serialize.SerializationFeature
, this is added as a required feature in one of the quarkus features.
From the above 1, 3, 6 and 9 seem not covered by this PR.
Here I suggest to just copy our implementation (as a starting point). This is a simple helper-method that itself only depends on JDK code. Thus you are better off having your own variant of it in your codebase (i.e. you might want to use such a method in places that otherwise do not require native-image at all). |
Here we should make sure that all SVM internal feature handlers have priority (i.e. are executed before) any user-provided feature handler (e.g. Quarkus features). This way your code that specifies SerializationFeature as a required feature becomes obsolete and can be removed. cc @christianwimmer |
No need to use the internal prepareBundle. Use |
I agree. We should discuss a custom solution for this use of BTW, thanks for the detailed list above @zakkak ! |
14bbe56
to
2406922
Compare
2406922
to
ca8f524
Compare
@zakkak if you stop using |
@zakkak I'm quite curious why you need this feature dependency at all. |
…s variant with String as API method
…xyClass} to java.lang.Class<?> arguments
7d455f8
to
69f7616
Compare
69f7616
to
779ce73
Compare
@olpaw Do I need to create a new issue with these remaining usages? |
That would be a good idea. Then it's easier to keep track of what is still open. |
This PR adds the missing APIs that will allow our users to not rely on our svm-internal APIs anymore.