Manuscript (Case [Issue]21567) Tools - TestResource class new sends super new initialize

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Manuscript (Case [Issue]21567) Tools - TestResource class new sends super new initialize

Pharo Issue Tracker
Manuscript Notification
avatar
Andrew P Black opened Case 21567: TestResource class new sends super new initialize and assigned it to Everyone:
Bug in Project:  Tools: 1. Pharo Image  •  You are subscribed to this case
The new method in TestResource class says;

new
    "Use #current to get the valid current instance.  Use of #new to get an instance (that should never be the current one) could be done in bizarre circumstances, so is not blocked, but will usually be inappropriate."
    
    ^super new initialize.

Notwithstanding the comment, this is still wrong, because super new is the method in Behavior, which is

    ^ self basicNew initialize

resulting in double initialization. I think that TestResource class>>#new should be self shouldNotImplement, with an appropriate comment explaining how to override it (self basicNew initialize) if circumstances are truly bizarre.  Or, if you believe (as the writer of the current comment evidently did) that TestResource class new should work, just delete the new method in TestResource class entirely.

You may argue that the double initialization shouldn't matter, because TestResources are initialized in setUp, not in initialize.  This is true, but irrelevant. In general, the creation of testResources is strange, and inadequacy documented, but this new method, and its comment, do not help.
Priority Priority: 5 – Fix If Time Status Status: Work Needed
Assigned To Assigned to: Everyone Milestone Milestone: Later

Go to Case
No longer need updates? Unsubscribe from this case.

Don't want Manuscript notifications anymore? Update your preferences.

Manuscript

_______________________________________________
Pharo-bugtracker mailing list
[hidden email]
https://lists.gforge.inria.fr/mailman/listinfo/pharo-bugtracker