commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [crypto] package access on ivars?
Date Tue, 08 Nov 2016 10:40:27 GMT
For vars that need to be accessed only within the package, there is
the choice of package-protected variable or p-p getter/setter.

The latter is simpler, and is my preference.

The problem with methods is that in theory they are easier to deal
with when maintaining API compat.
Protected and public fields are obvious potential issues and in theory
one can easily report on them; this is not the same for methods.
So less attention may be (is) paid to them. And they may be promoted
to protected or public with not much thought of the consequences.

However methods that are inadvertently exposed may not be easy to maintain.
For example if the method relates to a field that has changed type or usage.

On 8 November 2016 at 09:58, Stian Soiland-Reyes <stain@apache.org> wrote:
> Agree to change them to private. If there are particular fields that
> are always needed by a subclass, then it should be exposed as a
> protected method.  (The class is then later free to make those on
> demand)
>
> On 8 November 2016 at 09:43, Gary Gregory <garydgregory@gmail.com> wrote:
>> On Tue, Nov 8, 2016 at 1:40 AM, sebb <sebbaz@gmail.com> wrote:
>>
>>> On 8 November 2016 at 09:30, Gary Gregory <garydgregory@gmail.com> wrote:
>>> > On Tue, Nov 8, 2016 at 1:19 AM, sebb <sebbaz@gmail.com> wrote:
>>> >
>>> >> On 8 November 2016 at 07:34, Stian Soiland-Reyes <stain@apache.org>
>>> wrote:
>>> >> > I don't think binary compatibility should include package level
>>> access,
>>> >> as
>>> >> > long as that package is only used within a single Commons JAR,
then we
>>> >> are
>>> >> > free to change those, at least in a new minor release. (I would
say
>>> even
>>> >> > patch level unless serialisation is used).
>>> >> >
>>> >> > In particular, package level access means "don't touch" - it is
of
>>> course
>>> >> > possible to break into it by compiling into "our" package, but
I don't
>>> >> see
>>> >> > that as much different than introspection that changes access
>>> modifiers
>>> >> and
>>> >> > is not something we should support.
>>> >> >
>>> >> > So I would say we can fix it and release it as a new minor version.
>>> >>
>>> >> +1
>>> >>
>>> >
>>> > Sounds good. FTR: https://issues.apache.org/jira/browse/CRYPTO-129
>>>
>>> Why allow changing package-private to protected?
>>>
>>> That is a retrograde step.
>>>
>>> If the code works without exposing the variables as protected, then
>>> keep it like that otherwise we cannot change implementation later.
>>>
>>> IMO the main reason for using p-p access is allowing access outside a
>>> class but without affecting the external API.
>>>
>>> Only constants should be part of the public/protected API, and even
>>> those should be carefully considered.
>>>
>>
>> I initially mentioned in this thread making the ivars private. A reply was
>> made that protected was possible or desired for some ivars. The title of
>> the ticket reflects and respects the two views. If it were up to me I would
>> make them all private.
>>
>> Gary
>>
>>
>>> > Gary
>>> >
>>> >
>>> >>
>>> >> > On 8 Nov 2016 12:15 am, "Gary Gregory" <garydgregory@gmail.com>
>>> wrote:
>>> >> >
>>> >> >> On Mon, Nov 7, 2016 at 4:11 PM, sebb <sebbaz@gmail.com>
wrote:
>>> >> >>
>>> >> >> > On 6 November 2016 at 19:56, Gary Gregory <garydgregory@gmail.com>
>>> >> >> wrote:
>>> >> >> > > Hi all,
>>> >> >> > >
>>> >> >> > > I see ivars left at the package access level. This
must be an
>>> >> >> oversight,
>>> >> >> > > right?
>>> >> >> > >
>>> >> >> > > We can only fix that in 2.0 and a new package. What
a bummer!
>>> >> >> >
>>> >> >> > I'm not sure I understand.
>>> >> >> > Why would making package-protected fields private affect
>>> >> compatibility?
>>> >> >> >
>>> >> >>
>>> >> >> As a user, I can add a class to a [crypto] package and access
the
>>> ivars.
>>> >> >> Then when change the access level, my code will no longer compile.
If
>>> >> we do
>>> >> >> not define BC like that due to a class living in a package
it really
>>> >> has no
>>> >> >> business being in, then I'm OK with it.
>>> >> >>
>>> >> >> Gary
>>> >> >>
>>> >> >> >
>>> >> >> > > Gary
>>> >> >> > >
>>> >> >> > > --
>>> >> >> > > E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> >> >> > > Java Persistence with Hibernate, Second Edition
>>> >> >> > > <https://www.amazon.com/gp/product/1617290459/ref=as_li_
>>> >> >> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
>>> >> >> > linkCode=as2&tag=garygregory-20&linkId=
>>> cadb800f39946ec62ea2b1af9fe6a2
>>> >> b8>
>>> >> >> > >
>>> >> >> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=
>>> >> garygregory-20&l=am2&o=1&a=
>>> >> >> > 1617290459>
>>> >> >> > > JUnit in Action, Second Edition
>>> >> >> > > <https://www.amazon.com/gp/product/1935182021/ref=as_li_
>>> >> >> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
>>> >> >> > linkCode=as2&tag=garygregory-20&linkId=
>>> 31ecd1f6b6d1eaf8886ac902a24de4
>>> >> >> 18%22
>>> >> >> > >
>>> >> >> > >
>>> >> >> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=
>>> >> garygregory-20&l=am2&o=1&a=
>>> >> >> > 1935182021>
>>> >> >> > > Spring Batch in Action
>>> >> >> > > <https://www.amazon.com/gp/product/1935182951/ref=as_li_
>>> >> >> > tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
>>> >> >> > linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
>>> >> >> > 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>>> >> >> > > <http:////ir-na.amazon-adsystem.com/e/ir?t=
>>> >> garygregory-20&l=am2&o=1&a=
>>> >> >> > 1935182951>
>>> >> >> > > Blog: http://garygregory.wordpress.com
>>> >> >> > > Home: http://garygregory.com/
>>> >> >> > > Tweet! http://twitter.com/GaryGregory
>>> >> >> >
>>> >> >> > ------------------------------------------------------------
>>> ---------
>>> >> >> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> >> >> > For additional commands, e-mail: dev-help@commons.apache.org
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >>
>>> >> >> --
>>> >> >> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> >> >> Java Persistence with Hibernate, Second Edition
>>> >> >> <https://www.amazon.com/gp/product/1617290459/ref=as_li_
>>> >> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
>>> >> >> linkCode=as2&tag=garygregory-20&linkId=
>>> cadb800f39946ec62ea2b1af9fe6a2
>>> >> b8>
>>> >> >>
>>> >> >> <http:////ir-na.amazon-adsystem.com/e/ir?t=
>>> garygregory-20&l=am2&o=1&a=
>>> >> >> 1617290459>
>>> >> >> JUnit in Action, Second Edition
>>> >> >> <https://www.amazon.com/gp/product/1935182021/ref=as_li_
>>> >> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
>>> >> >> linkCode=as2&tag=garygregory-20&linkId=
>>> 31ecd1f6b6d1eaf8886ac902a24de4
>>> >> 18%22
>>> >> >> >
>>> >> >>
>>> >> >> <http:////ir-na.amazon-adsystem.com/e/ir?t=
>>> garygregory-20&l=am2&o=1&a=
>>> >> >> 1935182021>
>>> >> >> Spring Batch in Action
>>> >> >> <https://www.amazon.com/gp/product/1935182951/ref=as_li_
>>> >> >> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
>>> >> >> linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
>>> >> >> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>>> >> >> <http:////ir-na.amazon-adsystem.com/e/ir?t=
>>> garygregory-20&l=am2&o=1&a=
>>> >> >> 1935182951>
>>> >> >> Blog: http://garygregory.wordpress.com
>>> >> >> Home: http://garygregory.com/
>>> >> >> Tweet! http://twitter.com/GaryGregory
>>> >> >>
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> >> For additional commands, e-mail: dev-help@commons.apache.org
>>> >>
>>> >>
>>> >
>>> >
>>> > --
>>> > E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> > Java Persistence with Hibernate, Second Edition
>>> > <https://www.amazon.com/gp/product/1617290459/ref=as_li_
>>> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&
>>> linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>>> >
>>> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
>>> 1617290459>
>>> > JUnit in Action, Second Edition
>>> > <https://www.amazon.com/gp/product/1935182021/ref=as_li_
>>> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&
>>> linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22
>>> >
>>> >
>>> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
>>> 1935182021>
>>> > Spring Batch in Action
>>> > <https://www.amazon.com/gp/product/1935182951/ref=as_li_
>>> tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&
>>> linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%
>>> 7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>>> > <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=
>>> 1935182951>
>>> > Blog: http://garygregory.wordpress.com
>>> > Home: http://garygregory.com/
>>> > Tweet! http://twitter.com/GaryGregory
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>>
>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
>> JUnit in Action, Second Edition
>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
>>
>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
>> Spring Batch in Action
>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>
>
>
> --
> Stian Soiland-Reyes
> http://orcid.org/0000-0001-9842-9718
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message