I have an abstract class, relation in package database.relation and a subclass of it, Join, in package database.operations
The problem is that you are accessing other instance protected member.
You can apply multiple solutions, for example if possible you can declare in the parent class these two methods:
protected void copyRelationStructure(Relation r) {
this.copyStructure(r.mStructure);
}
protected void mergeRelationStructure(Relation r) {
for (final Header header: r.mStructure) {
if (!mStructure.contains(header)) {
mStructure.add(header);
}
}
}
And then in childs code replace:
this.copyStructure(mRelLeft.mStructure);
for (final Header header :mRelRight.mStructure) {
if (!mStructure.contains(header)) {
mStructure.add(header);
}
}
With:
this.copyRelationStructure(mRelLeft);
this.mergeRelationStructure(mRelRight);
That should work. Now Relation has the responsibility to provide methods that allow operations with itself inners to its children. Probably the reason behind this policy is that children should not mess with parent's internals unless they are part of the same software bundle in order to limit incompatibilities.