Each Discoverer is responsible for reporting an arbitrary number of implementations for each call to Discoverer.discover().
Sometimes, these Discoverers might find that one of the implementations is incorrect in some way. Instead of throwing an error, I think the principle of least surprise suggests that they should notify the user and move on, returning the correct discoveries instead of none at all. SciJava Log2's Logger class would be perfect for this.
Unfortunately, though, we don't provide the API for Discoverers to access a Logger, so as @ctrueden noticed Discoverers either use Throwable.printStackTrace or just use System.out.println or the equivalent.
I don't have a great idea of how to solve this. Off the top of my head we could:
- Add a
Logger to the discover function. I dislike this, I don't like metaparameters leaking into signatures.
- Make a
LoggingDiscoverer interface with getters/setters for a Logger.
- Make a static method somewhere that each
Discoverer could call to log errors. Would different Discoverers ever want to log to different outputs? If so, this probably is a bad idea.
Each
Discovereris responsible for reporting an arbitrary number of implementations for each call toDiscoverer.discover().Sometimes, these
Discoverers might find that one of the implementations is incorrect in some way. Instead of throwing an error, I think the principle of least surprise suggests that they should notify the user and move on, returning the correct discoveries instead of none at all. SciJava Log2'sLoggerclass would be perfect for this.Unfortunately, though, we don't provide the API for
Discoverers to access aLogger, so as @ctrueden noticedDiscovererseither useThrowable.printStackTraceor just useSystem.out.printlnor the equivalent.I don't have a great idea of how to solve this. Off the top of my head we could:
Loggerto thediscoverfunction. I dislike this, I don't like metaparameters leaking into signatures.LoggingDiscovererinterface with getters/setters for aLogger.Discoverercould call to log errors. Would differentDiscoverers ever want to log to different outputs? If so, this probably is a bad idea.