scijava / scijava-common

A plugin framework and application container with built-in extensibility mechanism :electric_plug:
BSD 2-Clause "Simplified" License
85 stars 53 forks source link

`Logger` parameters can't be used while initializing `DynamicCommand`s #446

Closed imagejan closed 1 year ago

imagejan commented 1 year ago

While using a LogService parameter for logging during the initialize method of an initializable DynamicCommand works just fine, the same cannot be done with a Logger parameter, as it throws a NullPointerException.

I assume the reason for this is the different priorities of LoggerPreprocessor vs. ServicePreprocessor:

https://github.com/scijava/scijava-common/blob/f1f666a8aded15e05660aece5707cd0f8b12521d/src/main/java/org/scijava/module/process/LoggerPreprocessor.java#L47-L48

https://github.com/scijava/scijava-common/blob/f1f666a8aded15e05660aece5707cd0f8b12521d/src/main/java/org/scijava/module/process/ServicePreprocessor.java#L62-L63

... and can likely be solved by increasing the priority of the former. I am unsure though if this might have any unwanted side effects elsewhere.

@ctrueden, @maarzt: if you agree, I'll test and file a pull request.