But I agree that only very few people/usecase would write codes which
extending the *Util classes.

Xeno Amess <xenoam...@gmail.com> 于2020年9月6日周日 下午9:53写道:

> >  Inheritance in Java on the static side is
> not the same as on the instance side
>
> Yep, I know it. It will not override but just, hiding.
> I admit it might confuse people sometimes.
>
> > subclassing a class that only
> provides static methods is no help.
>
> Well actually I personally use it for a shortcut or something.
> Of course we can do this by fork/wrap the static functions one by one, but
> extending it directly can make the codes shorter.
>
> Gary Gregory <garydgreg...@gmail.com> 于2020年9月6日周日 下午9:48写道:
>
>> On Sun, Sep 6, 2020 at 9:44 AM Xeno Amess <xenoam...@gmail.com> wrote:
>>
>> > The idea behind not making *Util constructors private is that it makes
>> > people be able to extend that class.
>> > for example:
>> >
>> >
>> https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/StringUtils.java#L9627
>>
>>
>> I have not see a use case that requires instances of classes that only
>> provide static methods in a long time, like the Javadoc mentions, there
>> used to be JavaBean tools that needed this, and some UI builders IIRC, but
>> I do not see a case of it today. Inheritance in Java on the static side is
>> not the same as on the instance side, so subclassing a class that only
>> provides static methods is no help.
>>
>> Gary
>>
>>
>> >
>> > Gary Gregory <garydgreg...@gmail.com> 于2020年9月6日周日 下午9:39写道:
>> >
>> > > The idea behind making *Util constructors private is that it does not
>> > make
>> > > sense to instantiate a class that only has static methods.
>> > >
>> > > Gary
>> > >
>> > >
>> > > On Sun, Sep 6, 2020 at 12:49 AM Xeno Amess <xenoam...@gmail.com>
>> wrote:
>> > >
>> > > > for example: can we make its constructor public instead of private?
>> > > >
>> > >
>> >
>>
>

Reply via email to