From 1e4c5b995f4dc797104b9d92dddd93df75689cb2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leif=20=C3=85strand?= Date: Tue, 21 Aug 2012 12:35:37 +0300 Subject: [PATCH] Don't generate widget creator if there's a createWidget method (#9371) --- .../widgetsetutils/metadata/WidgetInitVisitor.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/metadata/WidgetInitVisitor.java b/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/metadata/WidgetInitVisitor.java index 50ea60a3c6..4d63703151 100644 --- a/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/metadata/WidgetInitVisitor.java +++ b/client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/metadata/WidgetInitVisitor.java @@ -8,6 +8,7 @@ import com.google.gwt.core.ext.TreeLogger; import com.google.gwt.core.ext.typeinfo.JClassType; import com.google.gwt.core.ext.typeinfo.JMethod; import com.google.gwt.core.ext.typeinfo.JType; +import com.vaadin.terminal.gwt.client.ui.AbstractComponentConnector; public class WidgetInitVisitor extends TypeVisitor { @@ -15,6 +16,16 @@ public class WidgetInitVisitor extends TypeVisitor { public void visitConnector(TreeLogger logger, JClassType type, ConnectorBundle bundle) { if (ConnectorBundle.isConnectedComponentConnector(type)) { + JClassType createWidgetClass = findInheritedMethod(type, + "createWidget").getEnclosingType(); + boolean createWidgetOverridden = !createWidgetClass + .getQualifiedSourceName() + .equals(AbstractComponentConnector.class.getCanonicalName()); + if (createWidgetOverridden) { + // Don't generate if createWidget is already overridden + return; + } + JMethod getWidget = findInheritedMethod(type, "getWidget"); bundle.setNeedsReturnType(type, getWidget); -- 2.39.5