Ticket #1538 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

Eliminate type confusion in PluginInfo and CommandInfo

Reported by: curtis Owned by: curtis
Priority: major Milestone: imagej2-b7-ndim-data
Component: Plugin Framework Version:
Severity: serious Keywords:
Cc: Blocked By:
Blocking: #1357


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 7 years ago by curtis

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.

comment:2 Changed 7 years ago by curtis

  • Status changed from new to closed
  • Resolution set to fixed

This was merged to master back in October.

Note: See TracTickets for help on using tickets.