Closed kigkrazy closed 6 years ago
Thanks for your report. How can this be done on Android? Ideally, if you could provide a working PR, that would be awesome. I cannot verify this on Android right now...
I'm sorry to see it now. I solve problem with that code:
public Reflect set(String name, Object value) throws ReflectException {
try {
Field field = field0(name);
//fix by KigKrazy
// in anddroid, there is not "modifiers" field.
// if ((field.getModifiers() & Modifier.FINAL) == Modifier.FINAL) {
// Field modifiersField = Field.class.getDeclaredField("modifiers");
// modifiersField.setAccessible(true);
// modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
// }
field.set(object, unwrap(value));
return this;
}
catch (Exception e) {
throw new ReflectException(e);
}
}
my english is not good, hope U can understand.
I don't test in other platform, so there are no PR.
I see, so we could wrap the contents of that if
statement in a try-catch-ignore block, but then does setting the field still work if it's final, in android?
I've committed a fix to GitHub master, due for jOOQ 0.9.8. Would you mind checking if this fixes the issue for you?
Expected behavior and actual behavior:
Steps to reproduce the problem:
Versions:
====
I found the problem in the code :