The main focus of this PR is to make the PROPERTIES array in every model class be declared as an immutable list rather than an array. Immutable lists for model properties are safer than arrays because the user can't modify their contents accidentally (they'd have to work very hard to do so). This also reduces the need to pass an array to a varargs method, for which Android Studio logs an ambiguity warning if no explicit cast is present.
Several related APIs have been changed slightly in light of this. Most methods that accepted a varargs property list now have a variant that accepts List<? extends Property<?>> as well. Some APIs that consume List<Field<?>> or List<Property<?>> arguments are now more flexible and accept List<? extends Field<?>> or List<? extends Property<?>>. A (minor) typesafety issue related to bad handling of Function objects in the SqlTablequalifyField and related methods has also been fixed -- these methods now make a clear distinction between qualifyField, which returns a Field<?>, and qualifyProperty, which can infer its return type from its argument type.
Finally, methods and constructors that accepted Map<String, Object> have been removed in favor of variants that only accept ValuesStorage, which is more typesafe.
The main focus of this PR is to make the
PROPERTIES
array in every model class be declared as an immutable list rather than an array. Immutable lists for model properties are safer than arrays because the user can't modify their contents accidentally (they'd have to work very hard to do so). This also reduces the need to pass an array to a varargs method, for which Android Studio logs an ambiguity warning if no explicit cast is present.Several related APIs have been changed slightly in light of this. Most methods that accepted a varargs property list now have a variant that accepts
List<? extends Property<?>>
as well. Some APIs that consumeList<Field<?>>
orList<Property<?>>
arguments are now more flexible and acceptList<? extends Field<?>>
orList<? extends Property<?>>
. A (minor) typesafety issue related to bad handling ofFunction
objects in theSqlTable
qualifyField
and related methods has also been fixed -- these methods now make a clear distinction betweenqualifyField
, which returns aField<?>
, andqualifyProperty
, which can infer its return type from its argument type.Finally, methods and constructors that accepted
Map<String, Object>
have been removed in favor of variants that only acceptValuesStorage
, which is more typesafe.