On 06/05/20 16:52, Emond Papegaaij wrote:
Hi all, During my refactoring of the component state (WICKET-6774) I noticed that behavior ids are currently stored in a very inefficient way: an ArrayList is added to Component data to store references to behaviors with a stable id. On my branch I have eliminated this ArrayList, greatly reducing the size of components with stateful behaviors (such as AjaxLink). A behavior gets a stable id when it is stateful to be able to render this id in an URL. However, at the moment, it also gets a stable id when Component.getBehaviorId is called for that particular behavior. This is also documented in the method's javadoc. Do we really need this last part? It complicates the code a lot. In our code base nor in Wicket can I find a single place where this is actually used.
Actually I see that Component.getBehaviorId is used in AbstractAjaxTimerBehavior.getTimerId() and AbstractDefaultAjaxBehavior.onBind() which are however stateful behaviors.
I would like to suggest a change in the javadoc to state that stable ids are only guaranteed for stateful behaviors and change this in Wicket 9. The actual change in the implementation is not yet finished and does not need to ship in 9.0.0, but feel I cannot change the contract of a method in a minor release. Best regards, Emond