Deepthought
Deepthought copied to clipboard
why is updatesHandlerBase final in ChatUpdatesBuilderImpl?
In ChatUpdatesBuilderImpl
class we have private final Class<CustomUpdatesHandler> updatesHandlerBase;
as a field.
Then in public UpdatesHandlerBase build()
function we have:
final Constructor<CustomUpdatesHandler> constructor = updatesHandlerBase.getConstructor(IKernelComm.class,
IDifferenceParametersService.class, DatabaseManager.class);
final CustomUpdatesHandler updatesHandler =
constructor.newInstance(kernelComm, differenceParametersService, getDatabaseManager());
Why is it made final and then a new instance is made and returned? Couldn't it be just not final and the same instance returned after changes?