-
Notifications
You must be signed in to change notification settings - Fork 8
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
POJOs can be directly mutated by developers without fiber knowing #16
Comments
one option would be to create a copy of the POJO, with setters and getters (via gradle task generating code) such wrapper objects might be possible to be generated class PojoWrapper extends Pojo {
private Pojo wrappedObject;
public setX(int x) {
// do ir notify before or after
wrappedObject.setX(x);
}
} but i am not sure how to properly parse the existing POJO and turn it into AST or whatever to generate the wrapper this is just a example of what info would be needed, not a proposed format, it could be yaml, json or a existing format (maybe idea highlights it too)
this would generate just a POJO, no extra functions on there, maybe thats something one would want to add i think there is no real builtin way to monitor fields |
You could instead of POJOs declare configurations as interfaces with getter and setter methods. Neither option is particularly desirable tho. |
Maybe we can modify the backing Some thoughts to consider:
|
Because java optimises accesses to
final
fields, modifying them at runtime will result in unexpected behaviour. (and fiber shouldn't be modifying those in the first place)This means we are forced to disallow use of
final
in POJOs.However, this also means developers can directly set the values in a POJO, making it desynchronised with the IR it was merged into.
Implement a system to prevent this.
ir.markDirty()
method that checks for modificationsThe text was updated successfully, but these errors were encountered: