Commit 0c7156c
committed
CommandInfo: flag abstract classes as invalid
An abstract class cannot be instantiated, even by reflection.
So there will be grievous problems when it comes time to instantiate the
command, which will manifest with the following cryptic stack trace:
[ERROR] Cannot create module: foo.Bar
org.scijava.module.ModuleException: org.scijava.InstantiableException: java.lang.InstantiationException
at org.scijava.command.CommandModule.instantiateCommand(CommandModule.java:250)
at org.scijava.command.CommandModule.<init>(CommandModule.java:96)
at org.scijava.command.CommandInfo.createModule(CommandInfo.java:330)
at org.scijava.module.DefaultModuleService.createModule(DefaultModuleService.java:156)
...
Caused by: org.scijava.InstantiableException: java.lang.InstantiationException
at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:307)
at org.scijava.command.CommandInfo.createInstance(CommandInfo.java:250)
at org.scijava.command.CommandModule.instantiateCommand(CommandModule.java:247)
... 17 more
Caused by: java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(InstantiationExceptionConstructorAccessorImpl.java:48)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at java.lang.Class.newInstance(Class.java:433)
at org.scijava.plugin.PluginInfo.createInstance(PluginInfo.java:302)
... 19 more
Let's head off future confusion by marking abstract classes as invalid.1 parent afbcf64 commit 0c7156c
File tree
2 files changed
+13
-4
lines changed- src
- main/java/org/scijava/command
- test/java/org/scijava/command
2 files changed
+13
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
442 | 448 | | |
443 | 449 | | |
444 | 450 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | | - | |
88 | | - | |
| 87 | + | |
89 | 88 | | |
90 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | | - | |
| 95 | + | |
93 | 96 | | |
94 | 97 | | |
95 | 98 | | |
| |||
0 commit comments