Closed linux-china closed 2 years ago
Hello @linux-china and thanks! Looks like it can be easily integrated, I'll look into the details of those options how better they can be implemented, and will come back with more info!
Couldn't find any info about SubstitutionResources except this
This option basically only allow to specify resources like list of string to be substituted?
Like:
-H:SubstitutionResources=${.}/substitutions1.json,${.}/substitutions1.json
But what exactly they substitute? What is their purpose? I dont get it and couldn't find any documentation, may be you can provide some info please @linux-china
Yes, it's hard to find document, and you can find some examples from following:
Thanks! Looks like some wodo black magic, will try to find some more info from GraalVM devs
I deployed 0.18.0-SNASHOT
version, can you please try DynamycProxyHint
and give your feedback and potential bugs, cause I don't have any real world usages for this hint
@linux-china
Do not forget to add snapshot repo
repositories {
maven { url "https://s01.oss.sonatype.org/content/repositories/snapshots" }
}
Looks like Substitution option is deprecated so, no point in supporting it
https://github.com/oracle/graal/commit/6054669045f1504ccfbdf987f2200b365335de96
@GoodforGod yes, from https://www.graalvm.org/release-notes/22_0/. Removed the option -H:SubstitutionFiles=... to register substitutions via a JSON file.
But you can find some information from https://docs.oracle.com/en/graalvm/enterprise/22/docs/reference-manual/native-image/BuildConfiguration/
Looks like just devs forgot to clean up this doc, cause I asked them and they confirmed option is deprecated
@GoodforGod only few developers use substitution feature, and it's not for normal developers. @DynamycProxyHint is good enough for me now :)
Would like a lot to hear your feedback on @DynamicProxyHint, is it working properly, do you like the @DynamicProxyHint.Configuration hint annotation and is it useful, so please share your experience when you will play with it :)
Hello @linux-china any success trying @DynamicProxyHint
annotation?:)
@GoodforGod It works, and I forgot to give you feedback.
@DynamicProxyHint
interface UserService {
String findNickById(Integer id);
}
class UserServiceHandler implements InvocationHandler {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
return "nick: 1";
}
}
I think 0.18.0-SNAPSHOT did not merge https://github.com/GoodforGod/graalvm-hint/pull/3 :)
Expect new 0.18.0 version.
Great! Thanks for feedback!
Actually it is merged, but there is slight change, the artifact name is always hint
now and package name is same as class package name or default one, so the path for hints is something like:
"META-INF/native-image/" + package + "/hint/" + fileName;
If you have any issues with unnamed packages or any other, just let me know
@GoodforGod I got the following error if without package declare with 0.18.0-SNAPSHOT
error: Couldn't write META-INF/native-image//hint/dynamic-proxy-config.json due to: Invalid relative name: META-INF/native-image//hint/dynamic-proxy-config.json
error: Couldn't write META-INF/native-image//hint/native-image.properties due to: Invalid relative name: META-INF/native-image//hint/native-image.properties
error: Couldn't write META-INF/native-image//hint/reflect-config.json due to: Invalid relative name: META-INF/native-image//hint/reflect-config.json
3 errors
Just published 0.18.0-SNAPSHOT
with hotfix for this issue, please refresh dependencies in gradle/maven and try again, hope issue will be resolved :)
Yes, it works well without package declare now.
@GoodforGod, it's nice project 👍
Now I use optionNames to add DynamicProxy support with following code:
Another problem is
-H:SubstitutionResources=${.}/substitutions.json
, and substitutions should be supplied by json file.How about new @DynamicProxyHint and @SubstitutionHint annotations? I think they are more friendly to developers.