ttorrent icon indicating copy to clipboard operation
ttorrent copied to clipboard

Pleeease declare constructors, methods and fields as protected instead of private. :(

Open preston opened this issue 11 years ago • 5 comments

I have a few minor modifications I need to make to HTTPAnnouncementRequest, HTTPTrackerClient etc for my specific project. Unfortunately, many of these classes make heavy use of private declarations that effectively make them final. That is, cleanly building customizations on top of torrent is project pretty much impossible. Please please pleeeeeease change these declarations to allow things to be easily subclass-able!

For example:

  • HTTPTrackerClient#buildAnnounceRequest
  • HTTPAnnounceRequestMessage - all fields
  • HTTPAnnounceRequestMessage - constructor :(

preston avatar Dec 27 '14 05:12 preston

Composition vs inheritance? Can you achieve what you're looking for through composition instead?

mpetazzoni avatar Jan 04 '15 22:01 mpetazzoni

Unfortunately not as-is, since a number of the more important methods are a bit large.

preston avatar Jan 05 '15 17:01 preston

@mpetazzoni Would you accept a PR if I did some non-functional refactoring to break out a few methods and change some private declarations to protected?

preston avatar Jan 05 '15 20:01 preston

Sure, send away

mpetazzoni avatar Jan 06 '15 00:01 mpetazzoni

Done! PR submitted as #115.

preston avatar Jan 06 '15 06:01 preston