Vaadin 7.1: ReadOnlyException in addComponent()

I updated the Vaadin libs in my app from 7.0.7 to 7.1.1 and now I’m getting an error during construction of a form if a field is set to read-only.

The relevant code looks like this:


FormLayout fl = new FormLayout();
FieldGroup fg = new FieldGroup();
TextField f = new TextField();
[...]

f.setReadOnly(true);
fgQuote.bind(f, "fieldname");
fl.addComponent(f);

This used to work in 7.0.
After updating to 7.1 the last line causes this exception:


[...]

Caused by: com.vaadin.data.Property$ReadOnlyException
	at com.vaadin.ui.AbstractField.setValue(AbstractField.java:465)
	at com.vaadin.ui.AbstractField.setValue(AbstractField.java:445)
	at com.vaadin.ui.AbstractTextField.setValue(AbstractTextField.java:432)
	at com.vaadin.ui.AbstractTextField.setValue(AbstractTextField.java:35)
	at com.vaadin.ui.AbstractField.setConvertedValue(AbstractField.java:823)
	at com.vaadin.ui.AbstractField.localeMightHaveChanged(AbstractField.java:1400)
	at com.vaadin.ui.AbstractField.attach(AbstractField.java:1358)
	at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:478)
	at com.vaadin.ui.AbstractComponentContainer.addComponent(AbstractComponentContainer.java:215)
[...]

My work-around is to call f.setReadOnly(true) after fl.addComponent(f) - then it works again.

Question: Is this intended behaviour or maybe a bug?

If you look at it from a logical standpoint, it makes sense:
You are trying to assign a value (in the bind method) to a textfield which is readonly.
The only slightly weird thing is that it worked before 7.1.0. Maybe they changed something in the bind method or the readonly-method.
For safety I would always recommend you to use setReadonly only after you set the value/binding of a field.
The way it worked before sounds more like a bug to me then the current behavior.