You shouldn't be doing this. asWidget wasn't added to allow lazy
initialization of widgets.
It was added so that dummy widgets can pretend to be widgets--but
only in tests. When not testing, the assertion:
assert widget.asWidget() == widget
Should always pass.
In other words, the only implementations of asWidget should ever be:
A) In a real widget:
public Widget asWidget() {
return this;
}
B) In a stub/mock/fake widget:
public Widget asWidget() {
throw new RuntimeException("no, i'm not a real widget!");
}
While your use of asWidget is creative, it's not at all the intent, and
so it's not surprising you're seeing odd results.
- Stephen