commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Caswell" <ste...@caswell.name>
Subject RE: StringUtils constructor is private
Date Tue, 13 Aug 2002 00:59:48 GMT
I stand corrected on the Velocity issue. I'm still -1 on a public
constructor because:

a) I believe the developer should be scolded for trying to create an
instance of a class that clearly is not intended for construction and
b) the classes we are discussing are fairly low level, and I'm not
bothered by not being able to subclass.

I'm -0 on a protected constructor. If there is a different solution for
Velocity I'd prefer that approach. What do Velocity users do about all
the other multitudes of classes that don't have a public constructor?

Steven Caswell
steven@caswell.name
a.k.a Mungo Knotwise of Michel Delving
"One ring to rule them all, one ring to find them..."


> -----Original Message-----
> From: dlr@finemaltcoding.com [mailto:dlr@finemaltcoding.com] 
> Sent: Monday, August 12, 2002 6:20 PM
> To: Jakarta Commons Developers List
> Cc: steven@caswell.name
> Subject: Re: StringUtils constructor is private
> 
> 
> "Juozas Baliuka" <baliuka@centras.lt> writes:
> 
> > Object newInstance(Class clasz){
> >  try{
> >        Constructor constructor = clasz.getDeclaredConstructor( new 
> > Class[] {});
> >        constructor.setAccessible(true);
> >        return constructor.newInstance( new Object[]{});
> 
> No offense intended, but seeing private ctors used like that 
> makes me wince.  Does anyone have a serious problem with 
> providing a protected ctor?  There is clearly a valid use 
> case for introspection, and though we don't want to promote 
> this as the suggested mode of operation, is there really 
> enough value in explicitly dis-allowing it (by preventing 
> sub-classing)?
> -- 
> 
> Daniel Rall <dlr@finemaltcoding.com>
> 
> --
> To unsubscribe, e-mail:   
> <mailto:commons-dev-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <mailto:commons-dev-help@jakarta.apache.org>
> 
> 



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


Mime
View raw message