4 comments
Comment actions Permalink

kesh wrote:

Changes:

- Converts any object or primitive type to string.
- Bugfixes.

Plugin URL: http://www.intellij.org/twiki/bin/view/Main/AutoBoxingPlugin

/kesh


Hi Kesh,

first of all thanks for a useful plugin.
I think I found a bug related to your plugin which results in Idea just
hanging, probably in an endless loop.

Tried with version 0.3.2 and 0.5.1; happens in both versions.
If I remove the autoboxing.jar from the plugins directory, it is not reproducible
anymore.

In the Idea Console, pressing Ctrl-Break, the thread dump only contains one thread
which is not waiting, with the following stack trace:

"AWT-EventQueue-1" prio=7 tid=0x0F552390 nid=0xd1c waiting on condition
at java.lang.Class.getInterfaces(Native Method)
at org.intellij.autoboxing.PsiUtil.isInterfaceOfAncestor(PsiUtil.java:195)
at org.intellij.autoboxing.PsiUtil.isInterfaceOfAncestor(PsiUtil.java:197)
at org.intellij.autoboxing.PsiUtil.findPsiListInterfaceOrAncestor(PsiUtil.java:186)
at org.intellij.autoboxing.ArrayToCollectionIntention.isAvailable(ArrayToCollectionIntention.java:26)
at com.intellij.codeInsight.k.a.ce.c(ce.java:44)
at com.intellij.codeInsight.k.a.ce.b(ce.java:96)
at com.intellij.codeInsight.k.a.cn.run(cn.java:3)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.t.a(t.java:116)
at com.intellij.ide.t.dispatchEvent(t.java:16)
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)



How to reproduce:

1. enter the following code (but be prepared to have to kill Idea afterwards):


public static void main(String[] args ) {

String val = "kjkjjl";
Pattern pattern = Pattern.compile("something");
Matcher m = pattern.matcher(val);
if (m.matches()) {
// do something....
}
}


2. then change the declaration of String val to the following:
String[] val = new String[] { "1", "2", "3" };

3. then place your cursor in the line
Matcher m = pattern.matcher(val);
at or just after val


Thomas




0
Comment actions Permalink

Other places for convert to array intention - return and parameters of
method call:

return list;

method(list)


I have to say that using intentions seems more "natural" than calling the
toar live template.

Carlos


0
Comment actions Permalink

Thanks for the good test case. The fix will be available in couple of
minutes.

/kesh

tj wrote:

kesh wrote:

>> Changes:
>>
>> - Converts any object or primitive type to string.
>> - Bugfixes.
>>
>> Plugin URL: http://www.intellij.org/twiki/bin/view/Main/AutoBoxingPlugin
>>
>> /kesh
>>


Hi Kesh,

first of all thanks for a useful plugin.
I think I found a bug related to your plugin which results in Idea just
hanging, probably in an endless loop.

Tried with version 0.3.2 and 0.5.1; happens in both versions.
If I remove the autoboxing.jar from the plugins directory, it is not
reproducible
anymore.

In the Idea Console, pressing Ctrl-Break, the thread dump only contains
one thread
which is not waiting, with the following stack trace:

"AWT-EventQueue-1" prio=7 tid=0x0F552390 nid=0xd1c waiting on condition

at java.lang.Class.getInterfaces(Native Method)
at
org.intellij.autoboxing.PsiUtil.isInterfaceOfAncestor(PsiUtil.java:195)
at
org.intellij.autoboxing.PsiUtil.isInterfaceOfAncestor(PsiUtil.java:197)
at
org.intellij.autoboxing.PsiUtil.findPsiListInterfaceOrAncestor(PsiUtil.java:186)

at
org.intellij.autoboxing.ArrayToCollectionIntention.isAvailable(ArrayToCollectionIntention.java:26)

at com.intellij.codeInsight.k.a.ce.c(ce.java:44)
at com.intellij.codeInsight.k.a.ce.b(ce.java:96)
at com.intellij.codeInsight.k.a.cn.run(cn.java:3)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at com.intellij.ide.t.a(t.java:116)
at com.intellij.ide.t.dispatchEvent(t.java:16)
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)



How to reproduce:

1. enter the following code (but be prepared to have to kill Idea
afterwards):


public static void main(String[] args ) {

String val = "kjkjjl";
Pattern pattern = Pattern.compile("something");
Matcher m = pattern.matcher(val);
if (m.matches()) {
// do something....
}
}


2. then change the declaration of String val to the following:
String[] val = new String[] { "1", "2", "3" };

3. then place your cursor in the line
Matcher m = pattern.matcher(val);
at or just after val


Thomas




0
Comment actions Permalink

It is implemented in version 0.5.1 of the plugin.

/kesh

Carlos Costa e Silva wrote:

Other places for convert to array intention - return and parameters of
method call:

return list;

method(list)


I have to say that using intentions seems more "natural" than calling the
toar live template.

Carlos


0

Please sign in to leave a comment.