-
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
native-image : @Delete expects all dependencies of target class to be available? #1725
Comments
Interestingly, this usage fails with that exception only when So, IMO, this really looks like an bug in the implementation of how this is handled in https://github.com/oracle/graal/blob/master/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/substitute/AnnotationSubstitutionProcessor.java#L432 Here's an sample application (with a README) which reproduces this issue https://github.com/jaikiran/substratevm-test-deletion |
Unfortunately, there is no straightforward fix for this problem (otherwise we would of course just fix it). I think there is some misconception about |
As described in oracle/graal#1725 (comment) this option is not meant to be used in production and under certain circumstances it may cause oracle/graal#1725 to appear as in quarkusio/quarkus#16139.
As described in oracle/graal#1725 (comment) this option is not meant to be used in production and under certain circumstances it may cause oracle/graal#1725 to appear as in quarkusio/quarkus#16139.
Not sure I follow this. Yes, it makes no sense to |
@christianwimmer so maybe there is a broad misuse of Maybe we need a |
Hey, I'm curious if we could revisit this discussion. While I understand that This is why the setting is enabled by default in Spring Native (beta) and also for Google libraries (pre-GA). But I still think annotations for |
I think the only feasible option is to switch to something better than |
Fixed by 30ae9d3 in GraalVM for JDK 23 |
So |
Yes, but you will need the upcoming GraalVM for JDK 23 (expected to be released next week). I have also created a backport PR to bring this in GraalVM for JDK 21 as well, see graalvm/graalvm-community-jdk21u#22. Which might land in the next CPU release (mid or late October 2024) |
Great to hear that! I hope, we will be able to remove all the method stubs we created to make GraalVM happy. |
@ppalaga I might have misunderstood your question. You won't be able to "mark optional code that is not available". After all what's the point of deleting a non-existent class. But you will be able to delete classes that are available, but reference unavailable code. As a reminder there is #3225 as well. If you can point me to a specific case I could see if this fix affects it or not. |
That might be the case from #3225 (comment) I'll try the improved |
Imagine this original class:
Now imagine this usage of
@Delete
:So there's a
org.myapp.FooBar
which I wanted deleted from the native image and I have a@Delete
which tries to achieve that. Theorg.myapp.FooBar
has fields/methods which use types that are part of other (third party) libraries. Those libraries aren't present in the classpath of thenative-image
generation command. When I run thenative-image
command which looks something like this:This runs into an exception:
So it looks like the usage of
@Delete
expects the classpath to be complete with all the necessary dependencies, even though the target class is really being removed from the native-image? Is there a way the@Delete
can work without expecting the whole dependency graph to be avaiable to native image generation?I'm on Graal VM version 19.2.0.1.
The text was updated successfully, but these errors were encountered: