harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Blewitt" <alex.blew...@gmail.com>
Subject Re: [classlib][ldap] going to eliminate using public method to access private field
Date Thu, 22 Feb 2007 09:06:13 GMT
Arguably, that might be a bug in RI. What happens if someone wanted to
override it to e.g. get the list from somewhere else? Could we e.g.
raise it as a bug with Sun and see whether they are interested in
fixing it before making Harmony do the same thing?

I'm not against this change specifically, but it seems that we obey
the JavaDoc either way, so both implementations are possible; and my
feeling is that the current Harmony implementation is more elegant.

Alex.

On 22/02/07, Mikhail Loenko <mloenko@gmail.com> wrote:
> I'm fixing style of the javax.naming.ldap.LdapName
>
> Among other things it uses its public method
>
>     public List getRdns() {
>         return rdns;
>     }
>
> to access its private field rdns, like this:
>
>     public boolean isEmpty() {
>         return getRdns().size() == 0;
>     }
>
> but if I do
>
>        List l = new LinkedList();
>
>        LdapName ln = new LdapName(l) {
>            public List getRdns() {
>               throw new Error();
>            }
>
>        };
>
>        ln.isEmpty();
>
> on RI it does not throw Error. So I'm going to replace getRdns() with just rdns.
>
> If there are objections please speak up now
>
> Thanks,
> Mikhail
>

Mime
View raw message