Feature Requests item #1850775, was opened at 2007-12-14 08:37
Message generated for change (Comment added) made by daleking
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397081&aid=1850775&group_id=29721
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Check
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Anders Johansen (anderssewerin)
Assigned to: Nobody/Anonymous (nobody)
Summary: HideUtilityClassConstructor should check if class is final
Initial Comment:
The HideUtilityClassConstructor requires that a utility class has a private
constructor to prevent subclassing. However, if you declare the class final, it
cannot be subclassed, but CS still complains even if class is final and all
methods are public and static.
Thus, to keep CS happy, one has to add a privaet constructor, which makes my
unit test coverage tool unhappy, as there is no way to test that code ;)
----------------------------------------------------------------------
Comment By: Dale King (daleking)
Date: 2007-12-14 08:52
Message:
Logged In: YES
user_id=130378
Originator: NO
The point of the HideUtilityClassConstructor is to prevent instantiation
of the class since it only has static members. Declaring it final only
prevents instantiation by subclassing. It does not prevent direct
instantiation of the class itself.
Personally I never saw the point of preventing instantiation of utility
classes. Sure it is pointless to instantiate it, but there is no harm
eitber. So why go out of your way to prevent it.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=397081&aid=1850775&group_id=29721
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
|