I was working on an InteractiveCommand and testing it on an update site. During this work I added/removed @Parameters.
I eventually got stuck with:
[ERROR] java.lang.NullPointerException
at java.util.ArrayList.addAll(ArrayList.java:581)
at org.scijava.util.ClassUtils.getAnnotatedFields(ClassUtils.java:196)
at org.scijava.util.ClassUtils.getAnnotatedFields(ClassUtils.java:166)
at org.scijava.Context.getParameterFields(Context.java:447)
at org.scijava.Context.inject(Context.java:384)
at org.scijava.Context.inject(Context.java:501)
at org.scijava.Context.inject(Context.java:386)
at org.scijava.module.DefaultModuleService.createModule(DefaultModuleService.java:171)
at org.scijava.module.DefaultModuleService.run(DefaultModuleService.java:209)
at org.scijava.module.DefaultModuleService.run(DefaultModuleService.java:200)
at org.scijava.module.DefaultModuleService.run(DefaultModuleService.java:185)
at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:304)
at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:163)
at ij.IJ.runPlugIn(IJ.java)
at ij.Executer.runCommand(Executer.java:137)
at ij.Executer.run(Executer.java:66)
at java.lang.Thread.run(Thread.java:748)
java.lang.NullPointerException
at java.util.ArrayList.addAll(ArrayList.java:581)
at org.scijava.util.ClassUtils.getAnnotatedFields(ClassUtils.java:196)
at org.scijava.util.ClassUtils.getAnnotatedFields(ClassUtils.java:166)
at org.scijava.command.CommandInfo.checkFields(CommandInfo.java:447)
at org.scijava.command.CommandInfo.initParams(CommandInfo.java:433)
at org.scijava.command.CommandInfo.parseParams(CommandInfo.java:428)
at org.scijava.command.CommandInfo.isValid(CommandInfo.java:384)
at org.scijava.module.process.ValidityPreprocessor.process(ValidityPreprocessor.java:56)
at org.scijava.module.ModuleRunner.preProcess(ModuleRunner.java:105)
at org.scijava.module.ModuleRunner.run(ModuleRunner.java:157)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
at org.scijava.thread.DefaultThreadService.lambda$wrap$2(DefaultThreadService.java:228)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
This code was working fine in my IDE, but failing when deployed to the update site. The stacktrace/error didn't say which field was failing but I did see that it had something to do with cached values for the annotation.
Fix:
I deleted my .imagej/IJ_prefs.txt and this resolved the issue.
I'm filing this as an issue because I suspect the desired behavior here is not just to throw a NPE, but to either say which fields are failing or to go one step further and clear the cache for those fields.
I was working on an InteractiveCommand and testing it on an update site. During this work I added/removed @Parameters.
I eventually got stuck with:
This code was working fine in my IDE, but failing when deployed to the update site. The stacktrace/error didn't say which field was failing but I did see that it had something to do with cached values for the annotation.
Fix: I deleted my .imagej/IJ_prefs.txt and this resolved the issue.
I'm filing this as an issue because I suspect the desired behavior here is not just to throw a NPE, but to either say which fields are failing or to go one step further and clear the cache for those fields.