fenix-framework/fenix-framework — pull request #142 by smmf (2013-05-22 12:05:06+00:00)
Title: Fix: initInstance hierarchy

* This problem was detected after adding DomainBPlusTree. Problem: there
was a bug in the invocation of LeafNode.setEntries() from the constructor
of LeadNode. When actually creating an instance of DomainLeafNode, it
would invoke the override DomainLeafNode.setEntries(), which would attempt
to access a yet uninitialized slot (domainEntries). The solution is to
change how initInstance happens by invoking it only once from the
top-level AbstractDomainObject class, instead of invoking it once per
class hierarchy level.

@jcarvalho could you please review this PR and check that it doesn't break anything in jvstm-ojb? I only did a small run using FenixCodeGeneratorOneBoxPerObject and apparently it's ok (due to #141 I couldn't test with FenixCodeGenerator), but given that this commit affects the initInstance protocol, I'd like you to confirm it with a more serious test before merging. In particular, I've disabled some of the processing done by PostProcessDomainClasses.AddOJBConstructorClassAdapter ([original here](https://github.com/fenix-framework/fenix-framework/blob/develop/core/dml-compiler/code-generator/src/main/java/pt/ist/fenixframework/core/PostProcessDomainClasses.java#L131)): I think that adding an invocation to initInstance in the 'allocation-only' constructor should no longer occur, because it's now being done in AbstractDomainObject's constructor.