-
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
Improving documentation for @AutomaticFeature #1234
Comments
Try adding the feature class to the Regarding wildcards for reflection, we currently don't support that. |
I added the
But the class it is supposed to add is still not added. To support the wildcard - do you want to create separate issue for feature? |
Yes, please create a separate issue for the wildcard feature. |
What do you mean by:
|
Okay, I probably see the problem now:
When I call directly the |
No. Are you sure that |
Okay, that was my error. However, I fixed that and the classes are still not registered. Current code is: override fun beforeAnalysis(access: Feature.BeforeAnalysisAccess) {
RuntimeReflection.register(com.maxmind.geoip2.model.CountryResponse::class.java)
registerPackage("com.maxmind.geoip2.model")
registerPackage("com.maxmind.geoip2.record")
}
private fun registerPackage(packageName: String) {
val reflections = Reflections(packageName, SubTypesScanner(false))
val classes = reflections.getSubTypesOf(Any::class.java)
log.info("Registering package, found classes: ${classes.size}.")
for (clazz in classes) {
log.info("Registering $clazz.")
RuntimeReflection.register(clazz)
}
} which logs this during native-image:
Full log is here: https://gist.github.com/knyttl/645f9e557ce02a514e109f84673762d9 Basically not even the first line Is it okay, the When the compilation finishes and these classes should be used, I get:
|
|
Ah okay. I guess there is no wildcard like there is within the reflect.json file. |
I am trying to implement
@AutomaticFeature
described here:https://github.com/oracle/graal/blob/master/substratevm/REFLECTION.md#manual-configuration
I implemented the class, but it is not clear where it should be put. Firstly, I had it normally within my code, but it did not work. Then I found some information about
META-INF
directory, but it is still not being registered. I turned on the trace info for reflection with-H:+TraceServiceLoaderFeature
, but my class doesn't appear there.I am just trying simply the original example:
Also would it be possible to write wildcards within
reflect.json
- something like:There are tens of classes and writing each of them makes the file super long.
The text was updated successfully, but these errors were encountered: