[ANN] Intention Power-Pack 0.5 released

Announcing the release of Intention Power-Pack 0.5. It's available at http://www.intellij.org/twiki/bin/view/Main/IntentionPowerPack. Requires Aurora build 874 or higher. If there are any issues, don't hesitate to let me know about 'em.

New Configuration Options
-


There's now a configuration panel under IDE settings, which enables individual IntentionPowerPack intentions
to be turned off for the application. Unlike intentions disabled via the "click on the lightbulb" feature, intentions disabled via the configuration panel won't show up even if you hit alt-enter. This is useful
if you have InspectionGadgets installed, as several intentions in InspectionPowerPack duplicate quick-fixes
in InspectionGadgets (e.g."remove unnecessary parentheses", "simplify if statement", "replace assignment with operator assignment"). Note: Yes, the configuration panel looks very cheesy, and uses the default icon. Consider this a quick-and-dirty stop-gap until IDEA gets a native intention configuration panel (hint, hint).

New intentions
-


Replace == with "safe" .equals: foo == bar -> foo==null?bar==null:foo.equals(bar)

Merge "Or" branches: if(foo){return bar;} else if(baz){return bar;} ->if(foo||baz){return bar;}
Note: this can only be used if the branches are structurally identical

Replace string concatenation with StringBuffer .append: "foo" + bar + baz -> new StringBuffer().append("foo").append(bar).append(baz).toString()

"Flip .equals()" now works with .equalsIgnoreCase() as well

"Replace C-style array declaration with Java-style" now works with fields, as well as parameters and local variables.

Removed intention
-


The intentions to wrap if/for/while/do-while bodies in curly braces has been removed, as IDEA has (finally) been extended to do this automatically via "Reformat Code".

8 comments
Comment actions Permalink

I just got an exception. The Java file I'm editing is currently
malformed due to massive changes, which may be causing this. It's
repeatable in the sense that if I place the cursor in the same position
the error will occur over and over again.


java.lang.NullPointerException
at
com.siyeh.ipp.trivialif.IfReturnImplicitToConditionalPredicate.satisfiedBy(IfReturnImplicitToConditionalPredicate.java:47)
at com.siyeh.ipp.Intention.findMatchingElement(Intention.java:109)
at com.siyeh.ipp.Intention.isAvailable(Intention.java:127)
at com.intellij.codeInsight.g.a.ce.c(ce.java:39)
at com.intellij.codeInsight.g.a.ce.b(ce.java:26)
at com.intellij.codeInsight.g.a.cn.run(cn.java:4)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.s.a(s.java:90)
at com.intellij.ide.s.dispatchEvent(s.java:87)
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

Damn PSI null pointers are like ants, but particularly annoying sorts of ants that only show up when code is in an inconsistent state. I've got a fix, and will put up a patch shortly.

0
Comment actions Permalink

Dave Griffith wrote:

Damn PSI null pointers are like ants, but particularly annoying sorts
of ants that only show up when code is in an inconsistent state.


Yes, and it can't be easy programming against an interface which keeps
changing and has (as far as I have understood) no Javadocs. In any
case, don't take by reports as complaints, only as attempts to make a
great plugin even better!

0
Comment actions Permalink

And another NPE...

java.lang.NullPointerException
at
com.siyeh.ipp.trivialif.IfAssignToConditionalPredicate.satisfiedBy(IfAssignT
oConditionalPredicate.java:60)
at com.siyeh.ipp.Intention.findMatchingElement(Intention.java:109)
at com.siyeh.ipp.Intention.isAvailable(Intention.java:127)
at com.intellij.codeInsight.g.a.ce.c(ce.java:39)
at com.intellij.codeInsight.g.a.ce.b(ce.java:26)
at com.intellij.codeInsight.g.a.cn.run(cn.java:4)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.s.a(s.java:90)
at com.intellij.ide.s.dispatchEvent(s.java:87)
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

Take the following (syntactically incorrect) file:


Go to the switch statement, alt-enter, replace switch with if.



0
Comment actions Permalink

At a "try" statement. Not reproducible on a simple example.

ERROR - com.intellij.ide.IdeEventQueue - Error during dispatching of java.awt.event.InvocationEvent[INVOCATI
ON_DEFAULT,runnable=com.intellij.codeInsight.i.a.cn@1aca18d,notifier=null,catchExceptions=false,when=1063052920743] on s
un.awt.windows.WToolkit@1d8aebe
ERROR - com.intellij.ide.IdeEventQueue - IntelliJ IDEA (Aurora) Build #915
ERROR - com.intellij.ide.IdeEventQueue - JDK: 1.4.2
ERROR - com.intellij.ide.IdeEventQueue - VM: Java HotSpot(TM) Client VM
ERROR - com.intellij.ide.IdeEventQueue - Vendor: Sun Microsystems Inc.
ERROR - com.intellij.ide.IdeEventQueue - OS: Windows 2000
ERROR - com.intellij.ide.IdeEventQueue - Last Action: EditorDown
ERROR - com.intellij.ide.IdeEventQueue -
java.lang.NullPointerException
at com.siyeh.ipp.psiutils.ExceptionUtils.calculateExceptionsThrown(ExceptionUtils.java:234)
at com.siyeh.ipp.psiutils.ExceptionUtils.calculateExceptionsThrown(ExceptionUtils.java:81)
at com.siyeh.ipp.psiutils.ExceptionUtils.calculateExceptionsThrown(ExceptionUtils.java:309)
at com.siyeh.ipp.exceptions.DetailExceptionsPredicate.satisfiedBy(DetailExceptionsPredicate.java:39)
at com.siyeh.ipp.Intention.findMatchingElement(Intention.java:109)
at com.siyeh.ipp.Intention.isAvailable(Intention.java:127)
at com.intellij.codeInsight.i.a.ce.c(ce.java:128)
at com.intellij.codeInsight.i.a.ce.b(ce.java:124)
at com.intellij.codeInsight.i.a.cn.run(cn.java:2)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.s.a(s.java:61)
at com.intellij.ide.s.dispatchEvent(s.java:36)
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

Idea #922. Too fast typing/repeat pressing alt-enter I think.

ERROR - mand.impl.CommandProcessorImpl -
ERROR - mand.impl.CommandProcessorImpl - IntelliJ IDEA (Aurora) Build #922
ERROR - mand.impl.CommandProcessorImpl - JDK: 1.4.2
ERROR - mand.impl.CommandProcessorImpl - VM: Java HotSpot(TM) Client VM
ERROR - mand.impl.CommandProcessorImpl - Vendor: Sun Microsystems Inc.
ERROR - mand.impl.CommandProcessorImpl - OS: Windows 2000
ERROR - mand.impl.CommandProcessorImpl - Last Action: ShowIntentionActions
ERROR - mand.impl.CommandProcessorImpl - Current Command: Sort Modifers
ERROR - mand.impl.CommandProcessorImpl -
java.lang.NullPointerException
at com.intellij.psi.impl.source.bg.isWritable(bg.java:65)
at com.intellij.psi.impl.j.a(j.java:8)
at com.intellij.psi.impl.source.bz.checkSetModifierProperty(bz.java:42)
at com.intellij.psi.impl.source.bz.setModifierProperty(bz.java:115)
at com.siyeh.ig.style.MissortedModifiersInspection$SortModifiersFix.applyFix(MissortedModifiersInspection.java:98)
at com.intellij.codeInspection.n.bl.invoke(bl.java:2)
at com.intellij.codeInsight.intention.a.bk.run(bk.java:5)
at com.intellij.openapi.application.a.d.runWriteAction(d.java:48)
at com.intellij.codeInsight.intention.a.bj.run(bj.java)
at com.intellij.openapi.command.b.b.executeCommand(b.java:77)
at com.intellij.codeInsight.intention.a.bs.run(bs.java)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.s.a(s.java:46)
at com.intellij.ide.s.dispatchEvent(s.java:82)
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

navigating in folded if .. code.


java.lang.NullPointerException
at
com.siyeh.ipp.trivialif.IfReturnImplicitToConditionalPredicate.satisfiedBy(IfReturnImplicitToConditionalPredicate.java:47)
at com.siyeh.ipp.Intention.findMatchingElement(Intention.java:109)
at com.siyeh.ipp.Intention.isAvailable(Intention.java:127)
at com.intellij.codeInsight.d.a.cg.c(cg.java:64)
at com.intellij.codeInsight.d.a.cg.b(cg.java:134)
at com.intellij.codeInsight.d.a.co.run(co.java:1)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.s.a(s.java:1)
at com.intellij.ide.s.dispatchEvent(s.java:40)
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

Please sign in to leave a comment.