initialization of final fields

Martyn Pearce m.pearce@inpharmatica.co.uk
Thu Nov 4 01:07:00 GMT 1999


Per Bothner writes:
| Godmar Back <gback@cs.utah.edu> writes:
| 
| > My suggestion: until GCJ can prove that an assignment to a final 
| > variable is indeed illegal, could you make the error in   
| > expr.c:expand_java_field_op suppressable?
| 
| I think we can say that a method may assign to a final field
| iff the method is private and is only called (directly or indirectly)
| by the initializer.
| 
| You can verify this with two extra bits per method
| ...

Pathological example I know, but... I don't think we've covered the
possibility that a given initializer calls such a method more than
once.

Actually, I don't think it's so patholgical --- the method call might be 
embedded in a loop without thinking.

Mx.


More information about the Java mailing list