From e0e00befc848c242f986ba5cd993ae8610a7fa83 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Tue, 5 Nov 2013 15:41:45 +0200 Subject: [PATCH] Improve error message in createWidget() (#12901) Change-Id: If456a2be242754bcd1e0a8c5be00062a4355af35 --- .../client/ui/AbstractComponentConnector.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java index 6f98e29d03..8fdaf0a5be 100644 --- a/client/src/com/vaadin/client/ui/AbstractComponentConnector.java +++ b/client/src/com/vaadin/client/ui/AbstractComponentConnector.java @@ -15,6 +15,7 @@ */ package com.vaadin.client.ui; +import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.JsArrayString; import com.google.gwt.dom.client.Element; import com.google.gwt.user.client.ui.Focusable; @@ -68,8 +69,16 @@ public abstract class AbstractComponentConnector extends AbstractConnector /** * Creates and returns the widget for this VPaintableWidget. This method * should only be called once when initializing the paintable. + *

+ * You should typically not override this method since the framework by + * default generates an implementation that uses {@link GWT#create(Class)} + * to create a widget of the same type as returned by the most specific + * override of {@link #getWidget()}. If you do override the method, you + * can't call super.createWidget() since the metadata needed + * for that implementation is not generated if there's an override of the + * method. * - * @return + * @return a new widget instance to use for this component connector */ protected Widget createWidget() { Type type = TypeData.getType(getClass()); @@ -79,10 +88,12 @@ public abstract class AbstractComponentConnector extends AbstractConnector return (Widget) instance; } catch (NoDataException e) { throw new IllegalStateException( - "There is no information about the widget for " + "Default implementation of createWidget() does not work for " + Util.getSimpleName(this) - + ". Did you remember to compile the right widgetset?", - e); + + ". This might be caused by explicitely using " + + "super.createWidget(), using a widget type with " + + "generics or some unspecified problem with the " + + "widgetset compilation.", e); } } -- 2.39.5