In dozer 3.4, copy-by-reference directives in mapping files are ignored unless the source object is the same class as specified in the mapping - subclasses, anonymous subclasses, dynamic proxies etc will not work.
It does appear to work in 3.3.1.
I'll attach some unit tests illustrating the problem.
Using a simple mapping with one field name change and one copy by reference specified:
#testBase passes, just a sanity check
#testSubclassSource passes - the oneA <-> oneB mapping is still detected for an anonymous subclass of TestA.
#testReference passes - the copy-by-reference is fine for TestA itself.
#testReferenceSubclassSource fails - net.sf.dozer.util.mapping.MappingException: java.lang.InstantiationException: example.TestReference
example.TestReference has a private constructor to force an error if copy by reference isn't used.
I'm also completely unable to make the global configuration for copy-by-reference work, the GlobalReferenceTest illustrates this. This does not appear to be new to dozer 3.4, and may well be me doing something wrong - please point it out!
Log in to post a comment.