FlowingCode / ErrorWindowAddon

Error Window Vaadin Add-on
Apache License 2.0
9 stars 2 forks source link

ErrorWindow constructor should not call overridable methods #44

Closed javier-godoy closed 1 year ago

javier-godoy commented 1 year ago

Calling an overridable method from a constructor could result in failures or strange behaviors when instantiating a subclass which overrides the method.

ErrorWindow constructor (indirectly) calls createStackTraceArea() (protected, non-final) through the following chain: initWindow() -> createMainLayout() -> createExceptionTraceLayout() -> createStackTraceArea()

Moreover, the current approach makes impossible to to extend ErrorWindow in a sane way, or configure an existing instance of ErrorWindow. In addition, O(2^n) constructors are required (since most parameters are deemed "optional").

Proposal: initialize the window on attach.