Ticket #1538 (closed defect: fixed)
Opened 2012-10-19T13:10:11-05:00
Last modified 2013-03-19T10:48:30-05:00
Eliminate type confusion in PluginInfo and CommandInfo
Reported by: | curtis | Owned by: | curtis |
---|---|---|---|
Priority: | major | Milestone: |
|
Component: | Plugin Framework | Version: | |
Severity: | serious | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #1357 |
Description
PluginInfo requires a generic parameter P extends ImageJPlugin. The intent of that parameter (though not explicitly documented in javadoc) was to declare the *type* of plugin (e.g., the PluginInfo for AboutImageJ would be typed as PluginInfo<Command>). However, PluginService also uses P extends ImageJPlugin parameters in other places with Class<P> to declare the *class* of plugin (e.g., PluginService#getPluginsOfClass(AboutImageJ.class) has a P of type AboutImageJ, which is not a *type* of plugin at all).
Similarly, CommandInfo had a generic parameter C extends Command intended to document the *subtype* of Command. However, that is also inconsistent in some places within the CommandService.
All API relating to these generic parameters needs to be made consistent and clear.
Change History
comment:1 Changed 2012-10-19T13:10:28-05:00 by curtis
comment:2 Changed 2013-03-19T10:48:30-05:00 by curtis
- Status changed from new to closed
- Resolution set to fixed
This was merged to master back in October.
I started a new branch fix-plugin-typing that cleans up the mess, using PT extends ImageJPlugin for plugin *types* and P extends ImageJPlugin for plugin *classes*. It also removes the generic parameter from CommandInfo.
The code is untested but should compile except for some code relating to OptionsPlugin and UpdaterUI, which are the only two subtypes of Command at the moment.