I spent quite a bit of time today tracking down problems related to overloaded constructors in my RJB project. It appears
RJB considers any array in a constructor signature as simply an array hence does not distinguish between arrays of different
types when selecting which constructor it will invoke. Further, the selection of the constructor seems to vary platform
to platform. Colleagues working on Linux saw a different constructor invoked than I did on Mac OS X.
I'll attach an example illustrating the issue to this ticket. In the example, notice the following constructors:
public Widget (PartA[] aParts) {
this.aParts = aParts;
}
public Widget (PartB[] bParts) {
this.bParts = bParts;
}
From what I can tell, unless I explicitly specify which constructor I want using new_with_sig, there's no guarantee
which constructor will be called.
Ideally, I'd like a stronger type check which selects the correct constructor based on the contents of the array.
If a stronger type check is impossible, I'd be happy with a warning or exception letting me know I requested an ambiguous
operation.
|