Imagine I have a method like this
void myMethod(MyThing t) throws MyException {
t.foo = "bar";
if (t.condition()) {
throw new MyException();
}
}
If the exception is triggered, does the value of t.foo revert to whatever it was previously? Or does it keep the “bar” value?
The value of the foo property on your MyThing object will not revert on any Exception.
In your example, there is no
tryblock, but if there were one, you could perform your own type of rollback of the value in a correspondingcatchblock.