graal icon indicating copy to clipboard operation
graal copied to clipboard

Provide API for further use of non-API methods in Quarkus

Open zakkak opened this issue 2 years ago • 1 comments

Describe the issue

Quarkus still depends on some Classes/Methods under the package org.graalvm.nativeimage.impl which do not appear to have obvious alternatives at the moment. These are:

Relates to https://github.com/oracle/graal/issues/4919

cc @olpaw

zakkak avatar Sep 20 '22 12:09 zakkak

Regarding

We do not want to make that public API as it violates composability of the resource inclusion in native-image configuration metadata. There a several options to cope with that:

  • Get rid of depending on ignoreResources by not over-including resources in the first place. I.e. at build time, iterate/walk the resources that you want to have included and register them individually.
  • If you want to cancel out resource inclusion done by some other place (resource-config.json in some library that you use) , use --exclude-config <jar-with-bad-config> to get rid of its resource inclusion.
  • keep using RuntimeResourceSupport#ignoreResources by opening up org.graalvm.nativeimage.impl with --add-exports

cc @christianwimmer @vjovanov

olpaw avatar Sep 20 '22 13:09 olpaw

We have removed the invocations to org.graalvm.nativeimage.impl.RuntimeResourceSupport#ignoreResources in https://github.com/quarkusio/quarkus/pull/31185

Is there any feedback regarding org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport#rerunInitialization? Are there any plans to make this public as well, or not due to https://github.com/oracle/graal/pull/4684?

cc @christianwimmer

zakkak avatar Mar 06 '23 09:03 zakkak

rerunInitialization is certainly not going to be API, because as you correctly note https://github.com/oracle/graal/pull/4684 should make every class have the semantic of "rerun" without needing explicit registration.

christianwimmer avatar Mar 14 '23 00:03 christianwimmer

rerunInitialization is certainly not going to be API, because as you correctly note #4684 should make every class have the semantic of "rerun" without needing explicit registration.

@christianwimmer apparently that's not true for classes explicitly set for build time initialization (the default for all classes in Quarkus). Such classes still require explicit registration for runtime initialization. As a result Quarkus still depends on org.graalvm.nativeimage.impl.RuntimeClassInitializationSupport#rerunInitialization

zakkak avatar Feb 14 '24 09:02 zakkak

@zakkak with the new class initialization policy, RuntimeClassInitializationSupport#rerunInitialization is the same as initializeAtRunTime.

With https://github.com/oracle/graal/pull/8323/files#diff-3c452e61cb9ddfbab251a9aa0a134b4c0be47a0ec39020eee896e97a3ef5e2f1R55 rerunInitialization will be deprecated and hard-code to initializeAtRunTime.

christianwimmer avatar Feb 14 '24 22:02 christianwimmer

Oh, I didn't understand that. Thanks @christianwimmer, that seems to do the trick.

zakkak avatar Feb 15 '24 13:02 zakkak