You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context: improve javadoc for explicit service list
When instantiating a Context with an explicit list of services,
compatible services will be loaded in the order given, regardless of
their relative priorities. For example, if you write:
new Context(UsageService.class, EventService.class)
Then the DefaultUsageService will be loaded before the
DefaultEventService, resulting in the DefaultUsageService's event
handlers not being registered properly, since at the time of its
initialization the context's EventService will still be null.
So for the EventService in particular, it should almost always be the
first service given in the explicit list.
Presumably, there are similar problems when doing things like:
new Context(SCIFIOService.class, SciJavaService.class)
Since the EventService matches SciJavaService but not SCIFIOService,
although I did not test this. We will either need to:
A) Change such constructions to list the core SciJava services first; or
B) Change the behavior of context creation such that all compatible
services are _always_ loaded in priority order, regardless of the
order of the specified service template types.
Otherwise, any services which register event handlers, but do not
depend on the EventService explicitly or transitively, will not work
as expected in such scenarios.
0 commit comments