enhancement
minor
#24756
Typed configuration: no error when accessing mandatory properties that are not set
Accessing an unset property in a config item always results in an exception. This leads to a lot of quirky code like this:
value = ref.isMandatory() ? (config.valueSet(ref) ? config.value(ref) : null) : config.value(ref);
As long as you’re working generically with a config item, you can still write that. But as soon as you want to use the typed API, it gets really ugly—checking `valueSet` via the descriptor, property descriptor, and property name, only to then retrieve the value via the typed API using a different method.
Improvement
Accessing a programmatically created and not fully initialized config item returns the type-intrinsic default value for the property’s type. This default value may then violate the property’s constraints (e.g., non-nullable), but the same applies to all other constraints as well.
Test
- test.com.top_logic.basic.config.TestReset.testUnsetMandatoryProperty()