Goktug Gokdogan has uploaded a new change for review.

  https://gwt-review.googlesource.com/3250


Change subject: Fixes UiHandler method matching in generic classes
......................................................................

Fixes UiHandler method matching in generic classes

Method matching in UiHandler is completely broken for generic
ui fields as FieldWriterOfExistingType is using the raw type
of the ui field. Raw type of a generic field erases all generics
from the method signature. This was causing type parameter information
to be not used while matching methods. This is a huge problem with
some common events like SelectEvent and ValueChangeEvent.

We were not hitting the problem in some cases because JRawType is
broken and doesn't correctly delete the generics from the signature
of parent methods. However that was causing another problem:
UiBinder uses the type information for ui.xml so it doesn't really
know the type parameters so it can't match generics methods from the
parent class (Issue 6091).

This fix changes the UiBinder generator so that
 - it will enhance the type information if there is a @uifield declaration
 - it will not use raw type in FieldWriterOfExistingType
 - it will fallback to erase type if it can't find any method match

Bugs: Issue 6091

Change-Id: I3121542b6eb4f06f36b88b02006b155422c45726
---
M user/src/com/google/gwt/uibinder/rebind/FieldWriterOfExistingType.java
M user/src/com/google/gwt/uibinder/rebind/HandlerEvaluator.java
M user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java A user/test/com/google/gwt/uibinder/test/client/ExtendsValueChangeWidget.java
M user/test/com/google/gwt/uibinder/test/client/UiHandlerTest.java
A user/test/com/google/gwt/uibinder/test/client/ValueChangeWidget.java
M user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java
M user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
D user/test/com/google/gwt/uibinder/test/client/WildcardValueChangeWidget.java
9 files changed, 239 insertions(+), 153 deletions(-)



diff --git a/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfExistingType.java b/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfExistingType.java
index c6d8a35..46e5b73 100644
--- a/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfExistingType.java
+++ b/user/src/com/google/gwt/uibinder/rebind/FieldWriterOfExistingType.java
@@ -16,7 +16,6 @@
 package com.google.gwt.uibinder.rebind;

 import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.JGenericType;

 /**
* Implementation of FieldWriter for fields whose type already exists (that is,
@@ -33,12 +32,6 @@
     if (type == null) {
       throw new IllegalArgumentException("type cannot be null");
     }
-
-    JGenericType genericType = type.isGenericType();
-    if (genericType != null) {
-      type = genericType.getRawType();
-    }
-
     this.type = type;
   }

diff --git a/user/src/com/google/gwt/uibinder/rebind/HandlerEvaluator.java b/user/src/com/google/gwt/uibinder/rebind/HandlerEvaluator.java
index cc7bc2c..cae7dc4 100644
--- a/user/src/com/google/gwt/uibinder/rebind/HandlerEvaluator.java
+++ b/user/src/com/google/gwt/uibinder/rebind/HandlerEvaluator.java
@@ -23,8 +23,10 @@
 import com.google.gwt.core.ext.typeinfo.JType;
 import com.google.gwt.core.ext.typeinfo.TypeOracle;
 import com.google.gwt.event.shared.EventHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
 import com.google.gwt.uibinder.client.UiHandler;
 import com.google.gwt.uibinder.rebind.model.OwnerClass;
+import com.google.gwt.uibinder.rebind.model.OwnerField;
 import com.google.web.bindery.event.shared.HandlerRegistration;

 /**
@@ -153,10 +155,13 @@
("Method '%s' can not be bound. You probably missed ui:field='%s' "
                   + "in the template."), boundMethod, objectName);
         }
+        JClassType objectType = fieldWriter.getInstantiableType();
+        if (objectType.isGenericType() != null) {
+          objectType = tryEnhancingTypeInfo(objectName, objectType);
+        }

         // Retrieves the "add handler" method in the object.
-        JMethod addHandlerMethodType = getAddHandlerMethodForObject(
-            fieldWriter.getInstantiableType(), handlerType);
+ JMethod addHandlerMethodType = getAddHandlerMethodForObject(objectType, handlerType);
         if (addHandlerMethodType == null) {
logger.die("Field '%s' does not have an 'add%s' method associated.",
               objectName, handlerType.getName());
@@ -167,6 +172,23 @@
             addHandlerMethodType.getName(), objectName);
       }
     }
+  }
+
+ private JClassType tryEnhancingTypeInfo(String objectName, JClassType objectType) {
+    OwnerField uiField = ownerClass.getUiField(objectName);
+    if (uiField != null) {
+      JParameterizedType pType = uiField.getRawType().isParameterized();
+      if (pType != null) {
+ // Even field is parameterized, it might be a super class. In that case, if we use the field + // type then we might miss some add handlers methods from the objectType itself; something
+        // we don't want to happen!
+        if (pType.getBaseType().equals(objectType)) {
+ // Now we proved type from UiField is more specific, let's use that one
+          return pType;
+        }
+      }
+    }
+    return objectType;
   }

   /**
@@ -269,6 +291,7 @@
       JClassType handlerType) throws UnableToCompleteException {
     JMethod handlerMethod = null;
     JMethod alternativeHandlerMethod = null;
+    JMethod alternativeHandlerMethod2 = null;
     for (JMethod method : objectType.getInheritableMethods()) {

       // Condition 1: returns HandlerRegistration?
@@ -281,9 +304,9 @@
           continue;
         }

-        JType subjectHandler = parameters[0].getType();
+        JType methodParam = parameters[0].getType();

-        if (handlerType.equals(subjectHandler)) {
+        if (handlerType.equals(methodParam)) {

           // Condition 3: does more than one method match the condition?
           if (handlerMethod != null) {
@@ -293,6 +316,7 @@
           }

           handlerMethod = method;
+          continue;
         }

         /**
@@ -302,21 +326,30 @@
          * equality. For instance:
          *
          *   handlerType => TableHandler<String>
-         *   subjectHandler => TableHandler
+ * subjectHandler => Alt 1: TableHandler or Alt 2: TableHandler<T>
          *
          * This is done as an alternative handler method to preserve the
          * original logic.
          */
         JParameterizedType ptype = handlerType.isParameterized();
         if (ptype != null) {
-          if (subjectHandler.equals(ptype.getRawType())) {
+          // Alt 1: TableHandler<String> => TableHandler
+          if (methodParam.equals(ptype.getRawType())) {
             alternativeHandlerMethod = method;
+          }
+
+          // Alt 2: TableHandler<String> => TableHandler<T>
+          if (objectType.isGenericType() != null
+              && methodParam.getErasedType().equals(ptype.getRawType())) {
+ // Unfortunately this is overly lenient but it was always like this
+            alternativeHandlerMethod2 = method;
           }
         }
       }
     }

- return (handlerMethod != null) ? handlerMethod : alternativeHandlerMethod;
+    return (handlerMethod != null) ? handlerMethod
+ : (alternativeHandlerMethod != null) ? alternativeHandlerMethod : alternativeHandlerMethod2;
   }

   /**
diff --git a/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java b/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java
index 4ffaa60..31d9b59 100644
--- a/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java +++ b/user/test/com/google/gwt/uibinder/rebind/FieldWriterOfExistingTypeTest.java
@@ -16,8 +16,6 @@
 package com.google.gwt.uibinder.rebind;

 import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.JGenericType;
-import com.google.gwt.core.ext.typeinfo.JRawType;

 import junit.framework.TestCase;

@@ -33,7 +31,6 @@

   private static final String FIELD_NAME = "field_name";
private static final String QUALIFIED_SOURCE_NAME = "qualified_source_name"; - private static final String ARG_QUALIFIED_SOURCE_NAME = "arg_qualified_source_name";

   private IMocksControl control;

@@ -63,34 +60,7 @@
     control.verify();
   }

-  /**
-   * Generic type.
-   */
-  public void testGenericType() throws Exception {
-    JGenericType genericType = control.createMock(JGenericType.class);
-    expect(type.isGenericType()).andReturn(genericType);
-
-    JRawType rawType = control.createMock(JRawType.class);
-    expect(genericType.getRawType()).andReturn(rawType);
-
- expect(rawType.getQualifiedSourceName()).andReturn(QUALIFIED_SOURCE_NAME);
-
-    control.replay();
-    FieldWriter field = new FieldWriterOfExistingType(null,
-        FieldWriterType.DEFAULT, type, FIELD_NAME, MortalLogger.NULL);
-
-    assertSame(rawType, field.getAssignableType());
-    assertSame(rawType, field.getInstantiableType());
-    assertEquals(QUALIFIED_SOURCE_NAME, field.getQualifiedSourceName());
-    control.verify();
-  }
-
-  /**
-   * Non generic type.
-   */
-  public void testNonGenericType() throws Exception {
-    expect(type.isGenericType()).andReturn(null);
-
+  public void testType() throws Exception {
     expect(type.getQualifiedSourceName()).andReturn(QUALIFIED_SOURCE_NAME);

     control.replay();
diff --git a/user/test/com/google/gwt/uibinder/test/client/ExtendsValueChangeWidget.java b/user/test/com/google/gwt/uibinder/test/client/ExtendsValueChangeWidget.java
new file mode 100644
index 0000000..d37b7da
--- /dev/null
+++ b/user/test/com/google/gwt/uibinder/test/client/ExtendsValueChangeWidget.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.uibinder.test.client;
+
+/**
+ * A Widget that extends another with that has parameterized event handlers.
+ *
+ * @param <T> type for the value
+ */
+public class ExtendsValueChangeWidget<T> extends ValueChangeWidget<T> {
+}
diff --git a/user/test/com/google/gwt/uibinder/test/client/UiHandlerTest.java b/user/test/com/google/gwt/uibinder/test/client/UiHandlerTest.java
index 27b6c06..335117b 100644
--- a/user/test/com/google/gwt/uibinder/test/client/UiHandlerTest.java
+++ b/user/test/com/google/gwt/uibinder/test/client/UiHandlerTest.java
@@ -15,21 +15,20 @@
  */
 package com.google.gwt.uibinder.test.client;

-import com.google.gwt.junit.client.GWTTestCase;
-import com.google.gwt.user.client.ui.DockPanel;
+import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_LIST_T; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_STRING; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_T; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_WILDCARD; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.SELECT_HANDLER_T;

-import java.util.ArrayList;
-import java.util.List;
+import com.google.gwt.junit.client.GWTTestCase;

 /**
  * Functional test for UiHandler
- *
- * TODO(rluble): add more relevant tests.
  */
 public class UiHandlerTest extends GWTTestCase {
   private WidgetBasedUi widgetUi;
-  private DomBasedUi domUi;
-  private DockPanel root;

   @Override
   public String getModuleName() {
@@ -41,39 +40,43 @@
     super.gwtSetUp();
     UiBinderTestApp app = UiBinderTestApp.getInstance();
     widgetUi = app.getWidgetUi();
-    domUi = app.getDomUi();
-    root = widgetUi.root;
   }

   public void testValueChangeEvent() {
-    widgetUi.valueChangeEvent = null;
+    widgetUi.doubleValueChangeEvent = null;
     widgetUi.myDoubleBox.setValue(0.0);
     widgetUi.myDoubleBox.setValue(10.0, true);
-    assertNotNull(widgetUi.valueChangeEvent);
-    assertEquals(10.0, widgetUi.valueChangeEvent.getValue());
+    assertNotNull(widgetUi.doubleValueChangeEvent);
+    assertEquals(10.0, widgetUi.doubleValueChangeEvent.getValue());
   }

-  /**
- * Tests that the code generated for handling events parametrized by wildcards work.
-   */
-  public void testValueChangeEventWildcardString() {
-    widgetUi.wildcardValueChangeEventString = null;
-    widgetUi.myWildcardValueChangeWidgetString.setValue(null);
-    widgetUi.myWildcardValueChangeWidgetString.setValue("Changed");
-    assertNotNull(widgetUi.wildcardValueChangeEventString);
- assertEquals("Changed", (String) widgetUi.wildcardValueChangeEventString.getValue());
+  public void testValueChangeHandlers() {
+    ValueChangeWidget<?> w = widgetUi.myValueChangeWidget;
+    assertEquals(1, w.getHandlerCount(HANDLER_WILDCARD));
+    assertEquals(1, w.getHandlerCount(HANDLER_STRING));
+    assertEquals(1, w.getHandlerCount(HANDLER)); /* Matched by List<?> */
+    assertEquals(1, w.getHandlerCount(HANDLER_T));
+    assertEquals(1, w.getHandlerCount(HANDLER_LIST_T));
+    assertEquals(0, w.getHandlerCount(SELECT_HANDLER_T));
   }

-  /**
- * Tests that the code generated for handling events parametrized by wildcards work.
-   */
-  public void testValueChangeEventWildcardList() {
-    widgetUi.wildcardValueChangeEventList = null;
-    List<String> newValue = new ArrayList<String>();
-    newValue.add("Changed");
-    widgetUi.myWildcardValueChangeWidgetList.setValue(null);
-    widgetUi.myWildcardValueChangeWidgetList.setValue(newValue);
-    assertNotNull(widgetUi.wildcardValueChangeEventList);
- assertEquals(newValue, widgetUi.wildcardValueChangeEventList.getValue());
+  public void testValueChangeHandlers_extends() {
+    ValueChangeWidget<?> w_extends = widgetUi.myValueChangeWidget_extends;
+    assertEquals(1, w_extends.getHandlerCount(HANDLER_WILDCARD));
+    assertEquals(1, w_extends.getHandlerCount(HANDLER_STRING));
+ assertEquals(1, w_extends.getHandlerCount(HANDLER)); /* Matched by List<?> */
+    assertEquals(1, w_extends.getHandlerCount(HANDLER_T));
+    assertEquals(1, w_extends.getHandlerCount(HANDLER_LIST_T));
+    assertEquals(0, w_extends.getHandlerCount(SELECT_HANDLER_T));
   }
-}
\ No newline at end of file
+
+  public void testValueChangeHandlers_raw() {
+    ValueChangeWidget<?> w_raw = widgetUi.myValueChangeWidget_raw;
+    assertEquals(1, w_raw.getHandlerCount(HANDLER_WILDCARD));
+    assertEquals(1, w_raw.getHandlerCount(HANDLER_STRING));
+    assertEquals(1, w_raw.getHandlerCount(HANDLER));
+    assertEquals(0, w_raw.getHandlerCount(HANDLER_T));
+    assertEquals(0, w_raw.getHandlerCount(HANDLER_LIST_T));
+    assertEquals(1, w_raw.getHandlerCount(SELECT_HANDLER_T));
+  }
+}
diff --git a/user/test/com/google/gwt/uibinder/test/client/ValueChangeWidget.java b/user/test/com/google/gwt/uibinder/test/client/ValueChangeWidget.java
new file mode 100644
index 0000000..2381da4
--- /dev/null
+++ b/user/test/com/google/gwt/uibinder/test/client/ValueChangeWidget.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package com.google.gwt.uibinder.test.client;
+
+import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_LIST_T; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_STRING; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_T; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.HANDLER_WILDCARD; +import static com.google.gwt.uibinder.test.client.ValueChangeWidget.HandlerType.SELECT_HANDLER_T;
+
+import com.google.gwt.dom.client.Document;
+import com.google.gwt.event.logical.shared.SelectionHandler;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.ui.FocusWidget;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * A Widget that has parameterized event handlers.
+ *
+ * @param <T> type for the value
+ */
+public class ValueChangeWidget<T> extends FocusWidget {
+
+  enum HandlerType {
+ HANDLER, HANDLER_WILDCARD, HANDLER_STRING, HANDLER_T, HANDLER_LIST_T, SELECT_HANDLER_T,
+  }
+
+ private Map<HandlerType, Integer> handlers = new HashMap<HandlerType, Integer>();
+
+  protected ValueChangeWidget() {
+    super(Document.get().createDivElement());
+  }
+
+  public HandlerRegistration addValueHandler(ValueChangeHandler handler) {
+    return addHander(HANDLER);
+  }
+
+ public HandlerRegistration addValueHandlerT(ValueChangeHandler<T> handler) {
+    return addHander(HANDLER_T);
+  }
+
+ public HandlerRegistration addValueHandlerListT(ValueChangeHandler<List<T>> handler) {
+    return addHander(HANDLER_LIST_T);
+  }
+
+ public HandlerRegistration addValueHandlerString(ValueChangeHandler<String> handler) {
+    return addHander(HANDLER_STRING);
+  }
+
+ public HandlerRegistration addValueHandlerWildCard(ValueChangeHandler<?> handler) {
+    return addHander(HANDLER_WILDCARD);
+  }
+
+ public HandlerRegistration addSelectionHandlerT(SelectionHandler<T> handler) {
+    return addHander(SELECT_HANDLER_T);
+  }
+
+  private HandlerRegistration addHander(HandlerType name) {
+    handlers.put(name, getHandlerCount(name) + 1);
+    return null;
+  }
+
+  public int getHandlerCount(HandlerType name) {
+    Integer count = handlers.get(name);
+    return count == null ? 0 : count;
+  }
+}
diff --git a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java
index 31f250d..84f1d77 100644
--- a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java
+++ b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.java
@@ -24,6 +24,7 @@
 import com.google.gwt.dom.client.ParagraphElement;
 import com.google.gwt.dom.client.SpanElement;
 import com.google.gwt.dom.client.TableElement;
+import com.google.gwt.event.logical.shared.SelectionEvent;
 import com.google.gwt.event.logical.shared.ValueChangeEvent;
 import com.google.gwt.i18n.client.DateTimeFormat;
 import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
@@ -201,34 +202,64 @@
   Renderer doubleRenderer = DoubleRenderer.instance();
   @UiField ValueLabel<Double> myValueLabel;
   @UiField DoubleBox myDoubleBox;
-  @UiField(provided = true)
-  WildcardValueChangeWidget myWildcardValueChangeWidgetString =
-      new WildcardValueChangeWidget<String>();
-  @UiField(provided = true)
-  WildcardValueChangeWidget myWildcardValueChangeWidgetList =
-      new WildcardValueChangeWidget<List<?>>();
+  @SuppressWarnings("rawtypes")
+  @UiField ValueChangeWidget<List> myValueChangeWidget;
+  @SuppressWarnings("rawtypes")
+  @UiField ValueChangeWidget myValueChangeWidget_raw;
+  @SuppressWarnings("rawtypes")
+  @UiField ExtendsValueChangeWidget<List> myValueChangeWidget_extends;
   @UiField ImageElement myImage;
   @UiField HTML htmlWithComputedSafeHtml;
   @UiField HTML htmlWithComputedText;
   @UiField Label labelWithComputedText;

-  public ValueChangeEvent<Double> valueChangeEvent;
+  ValueChangeEvent<Double> doubleValueChangeEvent;
   @UiHandler("myDoubleBox")
   void onValueChange(ValueChangeEvent<Double> event) {
-    this.valueChangeEvent = event;
+    this.doubleValueChangeEvent = event;
   }

-  public ValueChangeEvent<?> wildcardValueChangeEventString;
-  @UiHandler("myWildcardValueChangeWidgetString")
-  void onWildcaredValueChangeString(ValueChangeEvent<?> event) {
-    this.wildcardValueChangeEventString = event;
-  }
+  @UiHandler("myValueChangeWidget")
+  void onWildcardValueChange(ValueChangeEvent<?> event) { /* EMPTY */}

-  public ValueChangeEvent<List<?>> wildcardValueChangeEventList;
-  @UiHandler("myWildcardValueChangeWidgetList")
-  void onWildcaredValueChangeList(ValueChangeEvent<List<?>> event) {
-    this.wildcardValueChangeEventList = event;
-  }
+  @UiHandler("myValueChangeWidget")
+  void onStringValueChange(ValueChangeEvent<String> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget")
+  void onListRawValueChange(ValueChangeEvent<List> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget")
+  void onListValueChange(ValueChangeEvent<List<List>> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget")
+ void onListWildcardValueChange(ValueChangeEvent<List<?>> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_extends")
+ void onWildcardValueChange_extends(ValueChangeEvent<?> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_extends")
+ void onStringValueChange_extends(ValueChangeEvent<String> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_extends")
+ void onListRawValueChange_extends(ValueChangeEvent<List> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_extends")
+ void onListValueChange_extends(ValueChangeEvent<List<List>> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_extends")
+ void onListWildcardValueChange_extends(ValueChangeEvent<List<?>> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_raw")
+  void onWildcardValueChange_raw(ValueChangeEvent<?> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_raw")
+ void onStringValueChange_raw(ValueChangeEvent<String> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_raw")
+  void onListValueChange_raw(ValueChangeEvent<List> event) { /* EMPTY */}
+
+  @UiHandler("myValueChangeWidget_raw")
+  void onSelection_raw(SelectionEvent<List> event) { /* EMPTY */}

   public WidgetBasedUi() {
     external.style().ensureInjected();
diff --git a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
index 06de8c4..5eea996 100644
--- a/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
+++ b/user/test/com/google/gwt/uibinder/test/client/WidgetBasedUi.ui.xml
@@ -692,8 +692,9 @@
<gwt3:google.gwt.user.client.ui.ValueLabel ui:field='myValueLabel' renderer='{doubleRenderer}' />

   <gwt:DoubleBox ui:field='myDoubleBox'  />
- <demo:WildcardValueChangeWidget ui:field='myWildcardValueChangeWidgetString' /> - <demo:WildcardValueChangeWidget ui:field='myWildcardValueChangeWidgetList' />
+  <demo:ValueChangeWidget ui:field='myValueChangeWidget' />
+  <demo:ValueChangeWidget ui:field='myValueChangeWidget_raw' />
+  <demo:ExtendsValueChangeWidget ui:field='myValueChangeWidget_extends' />

   <img src="{values.aUrl}" ui:field='myImage'/>

diff --git a/user/test/com/google/gwt/uibinder/test/client/WildcardValueChangeWidget.java b/user/test/com/google/gwt/uibinder/test/client/WildcardValueChangeWidget.java
deleted file mode 100644
index ef84770..0000000
--- a/user/test/com/google/gwt/uibinder/test/client/WildcardValueChangeWidget.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not - * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-package com.google.gwt.uibinder.test.client;
-
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.FocusWidget;
-
-/**
- * A Widget that has an event parametrized by a wildcard.
- * Note that parameterizing events by wildcards is not good practice.
- *
- * @param <T> Type for the value. Note that the addValueChangeHandler does not use <T>, but ?
- *            instead. (That is exactly what the test is testing).
- */
-public class WildcardValueChangeWidget<T> extends FocusWidget {
-
-  T myValue;
-
-  protected WildcardValueChangeWidget() {
-    super(Document.get().createDivElement());
-  }
-
-  /**
- * Here is the key for the test. ValueChangeHandler is parameterized by ? and not <T>
-   */
- public HandlerRegistration addValueChangeHandler(ValueChangeHandler<?> handler) {
-    return addHandler(handler, ValueChangeEvent.getType());
-  }
-
-  public T getValue() {
-    return myValue;
-  }
-
-  public void setValue(T value) {
-    myValue = value;
-    fireEvent(new ValueChangeEvent<T>(value) { });
-  }
-}

--
To view, visit https://gwt-review.googlesource.com/3250
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3121542b6eb4f06f36b88b02006b155422c45726
Gerrit-PatchSet: 1
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Goktug Gokdogan <[email protected]>

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "GWT Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to