If I do the following,
final class FooButton extends JButton{
FooButton(){
super("Foo");
addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e){
// do stuff
}
});
}
}
am I letting the this reference implicitly escape?
Yes, because in the anonymous inner class you could access it like this:
The code of the anonymous
ActionListenercould in principle be called and use theFooButtonbefore theFooButtonobject is fully initialized.