]> source.dussan.org Git - vaadin-framework.git/commitdiff
Erase type of BeanBinder#bindInstanceFields parameter in equality test 8.0.0.alpha9
authorAleksi Hietanen <aleksi@vaadin.com>
Fri, 9 Dec 2016 15:24:01 +0000 (17:24 +0200)
committerIlia Motornyi <elmot@vaadin.com>
Fri, 9 Dec 2016 15:24:01 +0000 (17:24 +0200)
Fixes vaadin/framework8-issues#466

server/src/main/java/com/vaadin/data/BeanBinder.java
server/src/test/java/com/vaadin/data/BeanBinderTest.java

index 22761c2cd7d4918738893093a5b451d3ac5594cb..c04a36186a01b733e8b018473167f348a2f59b45 100644 (file)
@@ -464,7 +464,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
                     memberField.getName(),
                     objectWithMemberFields.getClass().getName()));
         }
-        if (propertyType.equals(valueType)) {
+        if (propertyType.equals(GenericTypeReflector.erase(valueType))) {
             HasValue<?> field;
             // Get the field from the object
             try {
@@ -485,7 +485,7 @@ public class BeanBinder<BEAN> extends Binder<BEAN> {
             throw new IllegalStateException(String.format(
                     "Property type '%s' doesn't "
                             + "match the field type '%s'. "
-                            + "Binding should be configured manulaly using converter.",
+                            + "Binding should be configured manually using converter.",
                     propertyType.getName(), valueType.getTypeName()));
         }
     }
index fd15d3981c9fba7941391765fdf6d152666796ef..14f32bd1ec69117bdf098333a556d0a21aa8e433 100644 (file)
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertSame;
 
 import java.lang.reflect.Method;
 import java.util.List;
+import java.util.Set;
 
 import org.junit.Assert;
 import org.junit.Before;
@@ -13,10 +14,30 @@ import org.junit.Test;
 import com.vaadin.data.BeanBinder.BeanBindingBuilder;
 import com.vaadin.data.Binder.BindingBuilder;
 import com.vaadin.tests.data.bean.BeanToValidate;
+import com.vaadin.ui.CheckBoxGroup;
 
 public class BeanBinderTest
         extends BinderTestBase<BeanBinder<BeanToValidate>, BeanToValidate> {
 
+    private enum TestEnum {
+    }
+
+    private class TestClass {
+        private CheckBoxGroup<TestEnum> enums;
+    }
+
+    private class TestBean {
+        private Set<TestEnum> enums;
+
+        public Set<TestEnum> getEnums() {
+            return enums;
+        }
+
+        public void setEnums(Set<TestEnum> enums) {
+            this.enums = enums;
+        }
+    }
+
     @Before
     public void setUp() {
         binder = new BeanBinder<>(BeanToValidate.class);
@@ -25,6 +46,13 @@ public class BeanBinderTest
         item.setAge(32);
     }
 
+    @Test
+    public void bindInstanceFields_parameters_type_erased() {
+        BeanBinder<TestBean> otherBinder = new BeanBinder<>(TestBean.class);
+        TestClass testClass = new TestClass();
+        otherBinder.bindInstanceFields(testClass);
+    }
+
     @Test
     public void fieldBound_bindBean_fieldValueUpdated() {
         binder.bind(nameField, "firstname");