From 2c5dd49f00672b8df3c81609a9e82a04b9aabd03 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 15 Jun 2017 20:04:38 +0300 Subject: Only throw from Binder.bindInstanceFields if there are no bindings at all (#9487) Fixes #8986 --- server/src/main/java/com/vaadin/data/Binder.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/src/main/java/com/vaadin') diff --git a/server/src/main/java/com/vaadin/data/Binder.java b/server/src/main/java/com/vaadin/data/Binder.java index 98a9c65b2b..c36029aa83 100644 --- a/server/src/main/java/com/vaadin/data/Binder.java +++ b/server/src/main/java/com/vaadin/data/Binder.java @@ -2141,10 +2141,15 @@ public class Binder implements Serializable { (property, type) -> bindProperty(objectWithMemberFields, memberField, property, type))) .reduce(0, this::accumulate, Integer::sum); - if (numberOfBoundFields == 0) { + if (numberOfBoundFields == 0 && bindings.isEmpty() + && incompleteBindings.isEmpty()) { + // Throwing here for incomplete bindings would be wrong as they + // may be completed after this call. If they are not, setBean and + // other methods will throw for those cases throw new IllegalStateException("There are no instance fields " + "found for automatic binding"); } + } private boolean isFieldBound(Field memberField, -- cgit v1.2.3