[ANN] SmartIntroduce 1.5
Plugin Description:
The plugin tries to provide smart (and choosable) pre-selections for the
different Introduce-... refactorings. Additionally, it implements the following:
- Introduce variable for selected String-parts
http://www.intellij.net/tracker/idea/viewSCR?publicId=14438
- "Extract variable" fails for parts of string concatenation
http://www.intellij.net/tracker/idea/viewSCR?publicId=25278
Changes:
- IDEA build #3117 support
- Internal refactoring
- Added support for 'Introduce Variable' fails on arrays declaration
http://www.intellij.net/tracker/viewSCR?threadId=115619
Note that this is currently available for Irida only.
Sascha
Please sign in to leave a comment.
NPE with 1.5.1:
java.lang.NullPointerException
at com.intellij.psi.impl.source.resolve.b.isAccessible(b.java:163)
at com.intellij.psi.impl.source.resolve.b.isAccessible(b.java:230)
at com.intellij.refactoring.f.j$b_.a(j$b_.java:43)
at com.intellij.refactoring.f.j$b_.a(j$b_.java:1)
at com.intellij.refactoring.f.j.a(j.java:247)
at com.intellij.refactoring.f.j.performRefactoring(j.java:89)
at
com.intellij.refactoring.BaseRefactoringProcessor$10.run(BaseRefactoringProcessor.java:3)
at
com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:417)
at
com.intellij.refactoring.BaseRefactoringProcessor.a(BaseRefactoringProcessor.java:70)
at
com.intellij.refactoring.BaseRefactoringProcessor.access$400(BaseRefactoringProcessor.java:1)
at
com.intellij.refactoring.BaseRefactoringProcessor$5.run(BaseRefactoringProcessor.java:2)
at
com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:417)
at
com.intellij.refactoring.BaseRefactoringProcessor$4.run(BaseRefactoringProcessor.java:4)
at com.intellij.openapi.command.a.a.executeCommand(a.java:100)
at com.intellij.openapi.command.a.a.executeCommand(a.java:68)
at
com.intellij.refactoring.BaseRefactoringProcessor.a(BaseRefactoringProcessor.java:33)
at
com.intellij.refactoring.BaseRefactoringProcessor.run(BaseRefactoringProcessor.java:84)
at com.intellij.refactoring.f.k.a(k.java:72)
at com.intellij.refactoring.f.b.doAction(b.java:13)
at
com.intellij.refactoring.RefactoringDialog.doRefactorAction(RefactoringDialog.java:3)
at
com.intellij.refactoring.RefactoringDialog$RefactorAction.actionPerformed(RefactoringDialog.java)
at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1819)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1872)
at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:247)
at java.awt.Component.processMouseEvent(Component.java:5166)
at java.awt.Component.processEvent(Component.java:4963)
at java.awt.Container.processEvent(Container.java:1613)
at java.awt.Component.dispatchEventImpl(Component.java:3681)
at java.awt.Container.dispatchEventImpl(Container.java:1671)
at java.awt.Component.dispatchEvent(Component.java:3543)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3527)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3242)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3172)
at java.awt.Container.dispatchEventImpl(Container.java:1657)
at java.awt.Window.dispatchEventImpl(Window.java:1606)
at java.awt.Component.dispatchEvent(Component.java:3543)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
at
com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:139)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:18)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:1)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.Dialog$1.run(Dialog.java:540)
at java.awt.Dialog.show(Dialog.java:561)
at com.intellij.openapi.c.b.a$d_.show(a$d_.java:27)
at com.intellij.openapi.c.b.a.show(a.java:6)
at com.intellij.openapi.ui.DialogWrapper.show(DialogWrapper.java:711)
at com.intellij.refactoring.f.k.a(k.java:67)
at com.intellij.refactoring.f.k.invoke(k.java:48)
at
com.intellij.refactoring.actions.BaseRefactoringAction.actionPerformed(BaseRefactoringAction.java:33)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction.customExecute(SmartIntroduceAction.java:118)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction.actionPerformed(SmartIntroduceAction.java:59)
at com.intellij.openapi.keymap.a.e.a(e.java:74)
at com.intellij.openapi.keymap.a.e.b(e.java:103)
at com.intellij.openapi.keymap.a.e.a(e.java:123)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:132)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:1)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
>
>
SmartIntroduce NPE
code:
public static void foo (int i_1, int i_2)
{
{i_wrong, i_2}]]>
System.out.println ("i_1 = " + i_1);
System.out.println ("i_2 = " + i_2);
}
ava.lang.NullPointerException
at
org.intellij.plugins.smartIntroduce.actions.FixArrayInitializer.addTypeAndHierarchy(FixArrayInitializer.java:214)
at
org.intellij.plugins.smartIntroduce.actions.FixArrayInitializer.selectMatchingType(FixArrayInitializer.java:148)
at
org.intellij.plugins.smartIntroduce.actions.FixArrayInitializer.fixArrayInitializer(FixArrayInitializer.java:75)
at
org.intellij.plugins.smartIntroduce.actions.FixArrayInitializer.execute(FixArrayInitializer.java:40)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction$3.runEx(SmartIntroduceAction.java:249)
at
org.intellij.plugins.smartIntroduce.utils.RunnableExImpl.run(RunnableExImpl.java:18)
at
com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:58)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction$4.run(SmartIntroduceAction.java:260)
at com.intellij.openapi.command.a.a.executeCommand(a.java:23)
at com.intellij.openapi.command.a.a.executeCommand(a.java:36)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction.runCommand(SmartIntroduceAction.java:264)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction.doSmartSelection(SmartIntroduceAction.java:221)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction.customExecute(SmartIntroduceAction.java:114)
at
org.intellij.plugins.smartIntroduce.SmartIntroduceAction.actionPerformed(SmartIntroduceAction.java:59)
at com.intellij.openapi.keymap.a.e.a(e.java:34)
at com.intellij.openapi.keymap.a.e.b(e.java:92)
at com.intellij.openapi.keymap.a.e.a(e.java:163)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:137)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:156)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
Alain,
I'm not sure if that is really caused by the plugin. Is it reproducible for you? If yes, try to toggle
off the plugin (in the Tools menu) and try again. If it still happens, it's an IDEA-internal problem and
you should be able to auto-submit it, if not please try to create a test case that reproduces the exception
and I will look into it.
Sascha
Alain Ravet wrote:
Will be fixed ASAP (= tomorrow). I forgot to check in the 1.5.1 changes
and don't have them available right now :/
Sascha
Just uploaded 1.5.2
Note that the plugin does not handle array declarations that
/only/ contain unresolved references because it does not know
which type to use then.
Sascha
On the code below, I had to turn off the SmartIntroducePlugin to
introduce a field, because it would select the whole anonymous class
foo.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent e) {
boolean deletingT]]>heLastTask = true;
}
});
Alain
Alain Ravet wrote:
Yep, just a few days ago I stumbled over this as well. I think I'm not
gonna try to imitate IDEA's default behavior here but rather add some
kind of "]]>" entry to the list that invokes the action with the
previous selection state on the cursor location.
Sascha