I trust the HotSpot optimizer will blow this away. I recently discovered another place where you get a warning like this, which is when you reference a variable only in a dependent class. We can look for where this warning is issued - as well as the rangecheck that gives you the ‘clause cannot be reached’ warning that also sometimes trips me up. Unfortunately, I am too fuzzy to note it down because they mostly strike when I have other higher priority work to do. I do the variable=variable thing because I don’t like any warning in production code.
Maybe make an optional argument out of it with a default value?