TelegramBots icon indicating copy to clipboard operation
TelegramBots copied to clipboard

Protected access to default implementations

Open Shemplo opened this issue 3 years ago • 1 comments

I faced with a problem that I need to slightly override default implementation of UpdatesSupplier, but it caused significant changes.

I know that I can change UpdateSupplier via DefaultBotSession#setUpdatesSupplier, it's fine. But I can't access to some necessary fields (without reflection) that are used in default implementation ReaderThread#getUpdatesFromServer and might be necessary in custom implementation (such as token, requestConfig, lastReceivedUpdate, ...). So I have to read values from them and set values to them (lastReceivedUpdate) via reflection. I think that it's not convenient.

Suggestion:

  • Add getters to private fields or make them protected at least in non-final classes that can be overridden (f.e. DefaultBotSession)

Version: 5.2

Shemplo avatar May 03 '21 07:05 Shemplo

Plus on making the important methods non final and protected

Chase22 avatar May 03 '21 09:05 Chase22