There are several features in StreamBase Studio that help you detect and eliminate any schemas or constants imported into a module that are not currently being used by that module. Eliminating unused imports speeds up the build times for large StreamBase applications.
These features are:
-
Studio places a yellow typecheck warning triangle () on a module if it detects unused schemas or constants in that module. The warning icon is placed:
-
On the module's name in the Project Explorer view
-
On the module's top tab in the EventFlow Editor view
-
On the Definitions tab in the EventFlow Editor view
When the warning icon is shown, the Problems view shows an entry for that warning. If a module uses asterisks to import all schemas and constants, and at least one of the imports is used in the receiving module, then the warning icon does not show. You can disable this typecheck warning in the Typechecking panel of Studio Preferences.
-
-
When you use
> , unused imports are now removed as part of the extraction process. -
If a module has, say, five schema imports but actually uses only two of them, the Remove Unused Imports wizard removes the three unused ones. If a module uses the asterisk to import everything from a module or interface:
-
If at least one schema or constant imported with the asterisk is used, the wizard does nothing.
-
If the module uses none of the imports, the wizard removes the entire import statement.
Invoke the Remove Unused Imports wizard using one of these methods:
-
Select to make the module of interest currently active in the EventFlow Editor, then select
> > from Studio's top-level menu. -
Select a project name in the Project Explorer view, right-click, and select
> .
-
-
There is a Quick Fix option similar to the wizard described above. Select an unused import warning line in the Problems view, right-click, and select Quick Fix from the context menu. You can also select a warning line and press Ctrl+1. These options open a dialog that lets you remove unused wizards on all modules or a selection of the modules in the current Studio workspace that have imports.
Remember that in StreamBase as in other domains, warnings are not errors, and some cases of an unused import warning may turn out to be valid. For example, Studio cannot detect certain imports that only get used at module reference time, so there may be cases where a schema or constant is imported to support a variable defined in a distant module, but whose value can only be determined when running the entire application. In such cases, do not run the Unused Import Warning wizard. Instead, leave the warning icon in place and use a canvas Note to document the reason for the warning.