Skip to content

Complete the Third-Party API in Native Image #4919

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

Closed
christianwimmer opened this issue Sep 11, 2022 · 3 comments · Fixed by #4783
Closed

Complete the Third-Party API in Native Image #4919

christianwimmer opened this issue Sep 11, 2022 · 3 comments · Fixed by #4783
Assignees
Labels

Comments

@christianwimmer
Copy link

TL;DR

Users of native image currently rely on internals of the image generator, for a variety of reasons. We need to expand the API so that it covers the use cases of all current users. Eventually, the internals of the image generator will no longer be published on Maven.

Goals

Expand the API so that the following parts are covered by proper API:

  • JNI / Resource / Proxy / Serialization registration: These are currently not exposed as public API, but really for no good reason. The API will be a small facade for the already existing classes.
  • Provide API to query annotations without initializing all annotation classes: The getAnnotation method of Class, Method, and Field triggers initialization of all annotation classes of that member. The image generator already has a mechanism to load a single annotation without initializing the remaining annotation classes (see Native Image Committer Community Meeting 2022-06-30 #4687 for some details). This will be exposed as proper API.
  • Add API options that replace the current -H: options for frequently used options.

Move the following parts to the API project, so that for pragmatic reasons users can rely on it, but mark it clearly that these parts are not considered stable API:

  • AutomaticFeature: While the Feature interface is API, the annotation AutomaticFeature is not in the API. That is intentional: if a feature is necessary, then it should be added via the --features=... option in a native-image.properties file.
  • Substitution system annotations (Substitute, Alias, TargetClass, ...): The substitution system is powerful, but it is easy to make hard-to-detect mistakes. Until all important libraries have necessary code changes moved upstream and released, there is no good way to avoid substitutions. Therefore, move the annotations into the API module, but explicitly document them as not being supported API.

Non-Goals

Add new registration mechanism or new functionality to the image generator. Everything added to the API is already present in the image generator in the form of non-API classes.

@zakkak
Copy link
Collaborator

zakkak commented Sep 20, 2022

Related issue: #4862

@fniephaus
Copy link
Member

This has shipped with the 22.3 release. 🎉

Repository owner moved this from In Progress to Done in GraalVM Community Roadmap Oct 25, 2022
@fniephaus fniephaus unpinned this issue Dec 20, 2022
@Suvankarmnvr
Copy link

@zakkak

@fniephaus fniephaus moved this from Done to Released in GraalVM Community Roadmap Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment