Hey Everyone, I am having an issue that showed up in GWT 2.6.0 that was not present in 2.5.1. It seems that if a derived class overrides a method used by the base c-tor, any declared member variables are available in the base. It feels like a scoping issue. I posted a code snippet below. The bold sections are of interest:
public class BaseClass extends Composite implements HasWidgets { interface BaseClassUiBinder extends UiBinder<Widget, BaseClass> {} private static BaseClassUiBinder uiBinder = GWT.create(BaseClassUiBinder.class); /** * constructor for lazy-init, when working with UiBinder, it can use * attribute to set section title and content widget */ public BaseClass() { initWidget(uiBinder.createAndBindUi(this)); } public BaseClass(String title, Widget content) { this(); setSectionTitle(title); if (content != null) { add(content); } } public void setSectionTitle(String sectionTitle) { if (sectionTitle != null) { initHeader(sectionTitle); } } protected void initHeader(String title) { header.add(createHeader(title)); } /** * Default Behavior, can be overridden * @param title * @return */ protected Widget createHeader(String title) { return new Label(title); } @Override public void add(Widget w) { body.add(w); } @Override public void clear() { body.clear(); } @Override public Iterator<Widget> iterator() { return body.iterator(); } @Override public boolean remove(Widget w) { return body.remove(w); } @UiField FlowPanel body; @UiField FlowPanel header; } public class DerivedClass extends BaseClass { private Button someButton = null; public DerivedClass(String title, Widget content) { super(title, content); *//expect someButton to be NOT NULL, but it is still null* * someButton.setVisible(true);* * // if the private Button someButton declares a new Button() (i.e. private Button someButton = new Button()) * * // the code works but I do not think we are referencing the same object as declared in createHeader()* } *// we override this from the super class. This is called from BaseClass(String title, Widget content)* * protected Widget createHeader(String title)* * {* * final Widget superHeader = super.createHeader(title);* * final FlowPanel resultHeader = new FlowPanel();* * someButton = new Button();* * resultHeader.add(superHeader);* * resultHeader.add(someButton);* * return resultHeader;* * }* } I tested our code against 2.5.1 and we were not seeing the issue. referencing someButton as this.someButton or even DerivedClass.this.someButton does not change a thing. Any input or advice would be appreciated. Jono -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.