ditto
ditto copied to clipboard
ConfigWithFallback breaks contract of AbstractConfigValue.withFallback
Reproducer:
ConfigFactory.empty()
.withFallback(
ConfigWithFallback.newInstance(
ConfigFactory.empty(), "x", new KnownConfigValue[0]));
Expected behavior: An empty config object.
Actual behavior: ClassCastException thrown.
java.lang.ClassCastException: org.eclipse.ditto.services.utils.config.ConfigWithFallback cannot be cast to com.typesafe.config.impl.MergeableValue
at com.typesafe.config.impl.AbstractConfigValue.withFallback(AbstractConfigValue.java:274)
at com.typesafe.config.impl.AbstractConfigObject.withFallback(AbstractConfigObject.java:139)
at com.typesafe.config.impl.SimpleConfig.withFallback(SimpleConfig.java:569)
at com.typesafe.config.impl.SimpleConfig.withFallback(SimpleConfig.java:41)
Workaround: Render the ConfigWithFallback and parse it again.
Proposal: Move fallback values from Java code to .conf files for better documentation; ConfigWithFallback would become unnecessary.