The new class should be called LoaderOptions to keep the same pattern as with DumperOptions.
On the other hand we can use it as an argument for Constructor. It will be used differently then DumperOptions.
Then we keep the name and add constructors to all Constructors with default loader config.
I am not sure which approach is better.
P.S. If I want to experiment with your repository without merging the code then I get 4 (!) heads. Do you really need them all ?
On (1/2) Yes I thought calling it LoaderOptions at first, but did consider the fact that it was "configuration" to alter the behaviour.
to be honest, it it possibly better to rename it LoaderOptions, because that is consistent :-)
Regarding the 4 heads :-) .. yes you expose my complete lack of experience with mercurial
What I was trying to do was remove commits (in git, a rebase, or a "reset") of code that was no longer required. (let me see if I can correct that)
If we go this way (which I am not sure yet) we have to state explicitly in JavaDoc and maybe also somewhere in Documentation that "Key uniqueness can only be guaranteed for Maps (default maps), but not for SortedMap,Properties,JavaBeans. And don't forget that overriding createDefaultMap() requires also to re-implement this functionality."
And still IMHO current implementation is not consistent with the image developer gets doing this:
OK, guys, how about this one? It should cover much more cases, patch applies to the HEAD of @Ramon Buckland's fork (contains patch from previous comment)
Maybe more test would be nice. Actually test for merging is needed (not sure merge kills all duplicates. If so, no need to check for duplication after merging).
And may be then allowDuplicateKeys need to be moved to SafeConstructor, because extending just BaseConstructor will not provide this functionality.
Do you intend to raise a more specific expection, something like DuplicateKeyException?
In my opinion even using the already existing YAMLException would be fine, and arguably more appropriate than java.lang.IllegalStateException