[ANN] PreconditionPlugin

Hi all,

Here comes my first plugin (hold your horses), a precondition generator, ie
a tool that inserts assert statements at the begginning of a method for
validating input arguments.

How does it work?

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.
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..

Read more about it and/or download from
http://www.intellij.org/twiki/bin/view/Main/PreconditionPlugin

regards!

/Ole


3 comments
Comment actions Permalink

Couldn't get it to work. When I clicked on "OK" on your dialog box, I got an internal error, and the following exception:

0
Comment actions Permalink

oops.. thanks for the report..

the plugin excpects your classes to be inside a package, I guess yours is
not?

I'll fix this tonight!

regards,

/Ole


"Tobin Juday" <tsjuday@checkfree.com> wrote in message
news:7346985.1038241360508.JavaMail.jrun@is.intellij.net...

Couldn't get it to work. When I clicked on "OK" on your dialog box, I got

an internal error, and the following exception:

 [ 465819]  ERROR - mand.impl.CommandProcessorImpl - JDK: 1.4.1_01
> [ 465819]  ERROR - mand.impl.CommandProcessorImpl - VM: Java HotSpot(TM)
Client VM
> [ 465819]  ERROR - mand.impl.CommandProcessorImpl - Vendor: Sun
Microsystems Inc.
> [ 465819]  ERROR - mand.impl.CommandProcessorImpl - OS: Windows 2000
> [ 465819]  ERROR - mand.impl.CommandProcessorImpl - Last Action:
Actions.PreconditionPlugin.CreatePreconditions
> [ 465819]  ERROR - mand.impl.CommandProcessorImpl - Current Command:
Create Preconditon
> [ 465819]  ERROR - mand.impl.CommandProcessorImpl -
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
> at java.lang.String.substring(Unknown Source)
> at
com.eviware.plugins.precondition.controller.CreatePreconditionAction$Handler
.preprocessAssertionMessage(Unknown Source)
> at
com.eviware.plugins.precondition.controller.CreatePreconditionAction$Handler
.createAssertions(Unknown Source)
> at
com.eviware.plugins.precondition.controller.CreatePreconditionAction$Handler
.executeWriteAction(Unknown Source)
> at
com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler$1.run(Edit
orWriteActionHandler.java:1)
> at com.intellij.openapi.application.a.e.runWriteAction(e.java:171)
> at
com.intellij.openapi.editor.actionSystem.EditorWriteActionHandler.execute(Ed
itorWriteActionHandler.java:1)
> at
com.intellij.openapi.editor.actionSystem.EditorAction$1.run(EditorAction.jav
a:1)
> at com.intellij.openapi.command.b.b.executeCommand(b.java:62)
> at
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
Action.java:7)
> at
com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(Editor
Action.java:15)
> at com.intellij.openapi.a.a.e.a(e.java:20)
> at com.intellij.openapi.a.a.e.b(e.java:49)
> at com.intellij.openapi.a.a.e.a(e.java:82)
> at com.intellij.ide.q.dispatchEvent(q.java:17)
> at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
> at java.awt.EventDispatchThread.run(Unknown Source)]]>

>



0
Comment actions Permalink

Nope, it's not in a package. I just threw a little java file together to see your plugin work.

Tobin

0

Please sign in to leave a comment.