Starting with the following code...
byte foo = 1;
byte fooFoo = foo + foo;
When I try compiling this code I will get the following error...
The value 1 fits nicely into a byte; so does 1+1; and when the variable is final, the compiler can do constant folding. (in other words: the compiler doesn't use foo
when doing that + operation; but the "raw" 1 values)
But when the variable is not final, then all the interesting rules about conversions and promotions kick in (see here; you want to read section 5.12 about widening primitive conversions).
For the second part: making an array final still allows you to change any of its fields; so again; no constant folding possible; so that "widening" operation is kicking in again.