The getPackages() method returns an array of packages which is based on the internal map's iteration order.
Instead, the order should depend on the package addition/merge sequence.
E.g. if a KnowledgeBuilder adds the following resources:
r1 -> package p1
r2 -> package p2
r3 -> package p2
r4 -> package p3
r5 -> package p1
the sequence in the array should be p1, p3, p2