Having the NPE problem during view initialization I determined that
this element
@UiField(provided=true)
ShortMessageBox shortMessageBox;
causes it. When I remove it from the view everything works fine.
The ShortMessageBox is defined UIBinder-based componet:
public class ShortMessageBox extends Composite {
public interface ShortMessageBoxUiBinder extends UiBinder<Widget,
ShortMessageBox> {
}
@Inject
public ShortMessageBox(final ShortMessageBoxUiBinder
uiBinder) {
super();
initWidget(uiBinder.createAndBindUi(this));
clearMessageWidget();
}
....
}
As you can see I am using gin but I have other similarly defined
components that work just fine. Since I am not looking for solution
with this question I don't provide all supporting code.
The question is how to troubleshoot/debug UIBinder views and
components when the following exception encountered during
initialization:
Caused by: java.lang.NullPointerException
at
com.myapp.client.ui.ShortMessageBox_ShortMessageBoxUiBinderImpl.createAndBindUi(ShortMessageBox_ShortMessageBoxUiBinderImpl.java:
18)
at
com.myapp.client.ui.ShortMessageBox_ShortMessageBoxUiBinderImpl.createAndBindUi(ShortMessageBox_ShortMessageBoxUiBinderImpl.java:
1)
at com.myapp.client.ui.ShortMessageBox.<init>(ShortMessageBox.java:
33)
at
com.myapp.client.gin.MyAppGinjectorImpl.com$myapp$client$ui
$ShortMessageBox_ShortMessageBox_methodInjection(MyAppGinjectorImpl.java:
1058)
My problem is that something obviously going wrong during
ShortMessageBox initialization but no detailed information or ways to
debug it that I know of...