Question on new version assignment
Ta Ri Ki Sun
posted 13 years ago
My two cents - I do think that it might be nice to define things like record lengths, record names, etc. as final, since there's no reason for these things to change once they're initialized. The trick is to make sure that they're properly initialized (by reading the DB file header) by the time the appropriate constructor or / class initializer ends. And (more annoyingly) to convince the compiler that they're really initialized. I find that if I initialize all the instance finals in the constructor, the compiler is happy - but if I try to extract this to a separate (private) method for readability, the compiler whines about blank final fields. Very annoying. So I remove the "final" while refactoring, but I'm hoping to put it back in later...