In this discussion about the performance overhead of using reflection, it is stated:
Use of reflection can cause some runtime optimizations to be lost. For example, the following code is highly likely be optimized by a Java virtual machine:
int x = 1; x = 2; x = 3;
Equivalent code using Field.set*() may not.
Without reflection, what kind of runtime optimizations would be done by JVM?
In this case the code can be discarded as it doesn't appear to do anything.
If you used reflection I suspect it would still do something although you can't access a local variable using reflection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With