A precondition/class-invariant generator, ie a tool that can
- insert assert statements at the beginning of a method for validating input arguments.
- create methods for checking class invariants
This plugin is not a complete Design by Contract implementation, but it provides some of the basics.
Pressing Shift-Ctrl-T shows a dialog in which you can select one of the current classes methods and for each argument specify a precondition. When pressing OK the specified assert statement are generated into the code.
Pressing Shift-Ctrl-I shows a dialog in which you can select a condition for each of the current classes fields. When pressing OK a "checkInvariant" method is generated checking the specified conditions.
Available preconditions are configured in an external preconditions.xml file which maps preconditions and their error messages to specific types. The plugin "understands" inheritance and implementation, ie configuring a precondition for java.util.List will also make it applicable on java.util.ArrayList. Have a look at the file included and you'll get the hang of it..
Please share your precondition configurations with the rest of us, either by attaching them to this page or by inserting them into the zip
WARNING
- 1.0 Initial version
- 1.1 Added class invariant generation and fixed some bugs
- 1.2 Bugfixes only
- 1.3 Added ability to work with if conditions and exceptions rather than just assert statements.
- Configuration of preconditions from within the IDE settings
-- GlenStampoultzis - 25 Mar 2003
|
|