Form.setIemDataSource javadocs do not match implementation

setItemDataSource is supposed to “clear any fields” but it calls removeAllItems which actually removes property and corresponding Field from the form. This wreaks havoc on custom layouts that are not instances of CustomLayout. Is it possible to introduce a clearAllFields which will reinitialize the existing fields to the default value of the corresponding Property.

I have not tried yet, but the workaround seems to be to reinitialize the entire Form when the data source changes.