[Soot-list] Change default visibility in Soot to protected?
Patrick Lam
plam at sable.mcgill.ca
Fri Aug 14 09:21:32 EDT 2009
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Eric Bodden wrote:
> Hi all.
>
> This is an email to fellow contributors to Soot. In the past there
> have often been problems with Soot because some internal fields were
> inaccessible, often because they used default visibility. With such
> visibility, a field is only visible to classes in the same package,
> but *not* to sub-classes. This can hinder extensibility.
>
> Therefore I was wondering if we should do a batch change and change
> all default visible fields in Soot to being protected. Protected
> access makes a field visible to sub-classes *and* to the same package,
> so the change should only widen visibility.
I'm not sure such a change makes sense. Shouldn't we generally provide
accessor methods instead? Making these fields protected can make it
harder to reason about what a class is doing, since subclasses could
change its internal state unexpectedly.
I suggest that the best way to proceed is to look at a half dozen
examples of default-visibility fields and see if we can argue for a
sensible rule to follow in general.
pat
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkqFZNsACgkQNTVxnNGEyOgbcQCePUrQv1TVAAa871boyb1+nt4g
co0An3CQU9dLJz2ATJnxqOTmmvZlBTfp
=5Nx5
-----END PGP SIGNATURE-----
More information about the Soot-list
mailing list