]> source.dussan.org Git - vaadin-framework.git/commitdiff
Don't generate widget creator if there's a createWidget method (#9371)
authorLeif Åstrand <leif@vaadin.com>
Tue, 21 Aug 2012 09:35:37 +0000 (12:35 +0300)
committerLeif Åstrand <leif@vaadin.com>
Wed, 22 Aug 2012 16:25:31 +0000 (19:25 +0300)
client-compiler/src/com/vaadin/terminal/gwt/widgetsetutils/metadata/WidgetInitVisitor.java

index 50ea60a3c6d01c5786a94d24c6932a083de26d06..4d637031517a9024a8a616dd89db85fcee66a9aa 100644 (file)
@@ -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);