Christopher Oliver wrote:
> Carsten Ziegeler wrote:
>
> >Hi Christopher,
> >
> >I did make this change because of inheritance. The private fields/methods
> >very called from an inner class. This makes the compiler to
> create accessor
> >methods for the private fields so that the inner classes can reach
> >the private fields. Changing the fields to protected avoids this
> unnecessary
> >accessor methods.
> >
> OK. But that doesn't make sense (at least to me). Why should protected
> fields be accessible to inner classes but not private ones (inner
> classes do not extend the enclosing class)? Can you point me to where
> you got this information?
>
Oh, it's something I read a long time ago somewhere. I really don't
remember. But as a small hint, the Eclipse IDE gives you some nice
warnings at these places (if configured).

> >If you don't want that someone inherits from these classes make
> them final.
> >
> I cound do that but then you (or another developer) could simply remove
> it.
>
Yes, of course :) But if someone wants to change it he will have a good
reason for it and perhaps ask beforehand. And a comment in the class
could help as well.

Now, if you think that's better the way it was before, I can simply
revert the changes and try to ignore the warnings from Eclipse. No
problem with that.

Carsten

Reply via email to