[ 
https://issues.apache.org/jira/browse/COLLECTIONS-519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13977914#comment-13977914
 ] 

Radoslav Paskalev commented on COLLECTIONS-519:
-----------------------------------------------

Hello,
A class with static methods can be extended to hide the underlying library 
implementation, to add more functions and to decorate existing functions. 
Unfortunately, with the private constructor, the only way to do any of this is 
by embedding the utility class and writing wrapper methods for every utility 
method that needs to be exported. This is possible to do, but for simple use 
cases, where we need to add just one or two custom functions, this approach 
creates a lot of additional error prone work.

Best Regards

> private constructors in utility classes break existing code
> -----------------------------------------------------------
>
>                 Key: COLLECTIONS-519
>                 URL: https://issues.apache.org/jira/browse/COLLECTIONS-519
>             Project: Commons Collections
>          Issue Type: Bug
>    Affects Versions: 4.x
>            Reporter: Radoslav Paskalev
>
> Hello,
> In collections version 4.x all utility classes (example ListUtils, MapUtils, 
> PredicateUtils....) have private constructors. I consider this to be a 
> serious bug, as it breaks any possibility the classes to be extended by the 
> users.  The javadoc says that constructors are private in order to prevent 
> class instantiation but this object instantiation is not really problem and i 
> think it is more important to allow classes to be extended. The possibility 
> to extend utility classes was one of the major selling points of commons.lang 
> and commons.collections projects. In the latest commons.lang project the 
> utility classes still have public constructors.
> Best Regards



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to