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

[native-image] UserException thrown when Version is used from a substitution class #1889

Closed
gwenneg opened this issue Nov 25, 2019 · 7 comments · Fixed by #1890
Closed

[native-image] UserException thrown when Version is used from a substitution class #1889

gwenneg opened this issue Nov 25, 2019 · 7 comments · Fixed by #1890
Assignees
Milestone

Comments

@gwenneg
Copy link
Contributor

gwenneg commented Nov 25, 2019

Hi GraalVM team!

I tried to replace System.getProperty("org.graalvm.version").startsWith("19.2.") with Version.getCurrent().compareTo(19, 3) < 0 in a class similar to this one:

@TargetClass(value = Field.class, onlyWith = GraalVersion19_2.class)
final class FieldReplacement {
    // Content omitted
}

final class GraalVersion19_2 implements BooleanSupplier {
    public boolean getAsBoolean() {
        return Version.getCurrent().compareTo(19, 3) < 0;
    }
}

The following exception was then thrown during the native image generation:

Error: ImageSingletons do not contain key org.graalvm.home.HomeFinder
com.oracle.svm.core.util.UserError$UserException: ImageSingletons do not contain key org.graalvm.home.HomeFinder
	at com.oracle.svm.core.util.UserError.abort(UserError.java:65)
	at com.oracle.svm.hosted.ImageSingletonsSupportImpl$HostedManagement.doLookup(ImageSingletonsSupportImpl.java:119)
	at com.oracle.svm.hosted.ImageSingletonsSupportImpl.lookup(ImageSingletonsSupportImpl.java:44)
	at org.graalvm.nativeimage.ImageSingletons.lookup(ImageSingletons.java:86)
	at org.graalvm.home.HomeFinder.getInstance(HomeFinder.java:99)
	at org.graalvm.home.Version.getCurrent(Version.java:293)
	at io.quarkus.runtime.graal.GraalVersion19_2.getAsBoolean(FieldReplacement.java:62)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.findTargetClass(AnnotationSubstitutionProcessor.java:806)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.handleClass(AnnotationSubstitutionProcessor.java:252)
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.init(AnnotationSubstitutionProcessor.java:230)
	at com.oracle.svm.hosted.NativeImageGenerator.createDeclarativeSubstitutionProcessor(NativeImageGenerator.java:876)
	at com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:825)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:528)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:445)
	at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Error: Image build request failed with exit status 1

Is that an expected behavior?

@gwenneg gwenneg changed the title UserException thrown when Version is used from a substitution class [native-image] UserException thrown when Version is used from a substitution class Nov 26, 2019
@jaikiran
Copy link
Contributor

Hello @gwenneg, I think this might help #1890

@gwenneg
Copy link
Contributor Author

gwenneg commented Nov 26, 2019

Great, thanks @jaikiran!

@eregon
Copy link
Member

eregon commented Nov 27, 2019

A workaround for 19.3.0 only (#1890 will change it) would be to include that feature explicitly with:

--features=org.graalvm.home.HomeFinderFeature

@gwenneg
Copy link
Contributor Author

gwenneg commented Nov 27, 2019

That's good to know, thanks @eregon!

@gwenneg
Copy link
Contributor Author

gwenneg commented Feb 4, 2020

Was this issue fixed in 19.3.1 as suggested by the current milestone? I don't see the fix in the 19.3.1 commits and the issue is not mentioned in the release note.

@gwenneg
Copy link
Contributor Author

gwenneg commented Feb 9, 2020

@thomaswue Do you have the answer to my question above?

@dougxc
Copy link
Member

dougxc commented Feb 10, 2020

@cstancu maybe you can answer this question?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants