EventDetector complete constructor accessibility

Hi Orekit team :slight_smile:
I have an architectural question.

Sometimes I create custom EventDetector, mostly a copy of Orekit ones, adding maybe some local variable, but keeping the g function as it is.
Yes, it is a quite ugly copy paste due to the fact that I cannot directly extends from the EventDetector as normally the complete constructor (with the Handler) is private.

I noticed that in ExtremumApproachDetector the complete constructor is indeed public.

public ExtremumApproachDetector(
            final double maxCheck, final double threshold, final int maxIter,
            final EventHandler<? super ExtremumApproachDetector> handler,
            final PVCoordinatesProvider secondaryPVProvider) {
        super(maxCheck, threshold, maxIter, handler);
        this.secondaryPVProvider = secondaryPVProvider;

As this is a new event detector, I wonder if the tendency will be to move all the constructors to public (that would help a lot class inheritance) or it was just random.


It was most probably random, but if required by users, it could become the new normal.

Thanks @luc
It would be nice. With public complete constructor, a child class of EventDetector can use the same parent .withHandler() to instantiate the class with a custom handler, without copy-pasting dead code, but just adapting the create method.


Could you open an issue for that, or even better, provide a pull request with a patch?

Maybe protected rather than public would be sufficient.
Also note this should be done for all regular and all field detectors.

Good idea.
Just opened the issue EventDetector complete constructors to protected (#1143) · Issues · Orekit / Orekit · GitLab
The patch will be quite simple