-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fix the defineClass exception in camel-quarkus-jsonpath while running in native mode #610
Comments
Thanks @lburgazzoli for discussing the case. |
looking a little bit into this issue you probably need to substitute:
Something like: @TargetClass(JSONValue.class)
class JSONValueSubstitution {
@Substitute
public static void writeJSONString(Object value, Appendable out, JSONStyle compression) throws IOException {
if (value == null) {
out.append("null");
return;
}
Class<?> clz = value.getClass();
@SuppressWarnings("rawtypes")
JsonWriterI w = defaultWriter.getWrite(clz);
if (w == null) {
if (clz.isArray())
w = JsonWriter.arrayWriter;
else {
w = defaultWriter.getWriterByInterface(value.getClass());
if (w == null)
throw new UnsupportedOperationException("...")
}
defaultWriter.registerWriter(w, clz);
}
w.writeJSONString(value, out, compression);
}
} @TargetClass(JSONWriter.class)
class JSONWriterSubstitution {
@Delete
static public JsonWriterI<Object> beansWriterASM;
} Not sure it it is enough but the issue is that the library tries to generate classes in case it does not find a suitable writer. An potential future evolution would be to generate such classes at build time. |
@lburgazzoli, you were few brackets from having it fully done :) Thanks for analysis and proposal by the way 👍 |
I've pushed a fix, let's ensure next build is fine with that. |
The build is fine regarding this ticket, closing. |
How to reproduce:
Set false in integration-tests/jsonpath/pom.xml
Run mvn clean verify -P native
An issue where the @deleted defineClass method would be accessed is reported.
The text was updated successfully, but these errors were encountered: