Hi,
I am using Lambda expressions more and more…
So from the Vaadin book we have:
layout.addComponent(new Button("Click Me!", event -> event.getButton().setCaption("You made click!")));
So what happens when the window / form / layout that the button is on is closed / removed from the UI?
Will it ever get freed (i.e. garbage collected)? I never call button.removeClickListener, so is the list of click listeners referencing an object (not sure which object), that will stop the list / button / layout etc from getting garbage collected because it is still referenced from somewhere?
I imagine the question applies to any listener framework with Java 8 lamdas… you don’t remove the listener so therefore things stay around (although not visible). Basically is it a case of the obsolete reference problem?
Does Java 8 lambda’s somehow get around it, or is it solved some other way, or just not worried about?
Regards
Colin