Community
Participate
Working Groups
I20060505-1306, follow-up to bug 139932. public void foo() { int i= 10; System.out.println(i); } - select any line, e.g. "int i= 10;" - Surround With > runnable - result is: public void foo() { int i; new Runnable() { public void run() { i = 10; } } System.out.println(i); } -> missing ";" after "new Runnable() {[..]}"
Used to work in 3.1.x
Benno, can you comment? I thought this was once discussed and there where reasosn for not having a semicolon in the template?
The reason for me not to have this implemented was my belive, that this is an enhancement request and there where enough bugs to fix. I would have to think about this again if this is a regression against 3.1.x, of course. However, I can not bring 3.1.2 to insert this semicolon, the result produced by 3.1.2 is: new Runnable() { public void run() { int i = 10; } } System.out.println(i); With the only difference that the var decl is not splited. I can't see a regression here and I can't find a bug report ever requested that feature. Workaround is to define two templates: Runnable expr and Runnable stmt, with the only difference that the second one ends with a semicolon.
not for 3.2
Sorry guys, this is a tough one. I need a use case for this request. I don't understand why you would want to have code like: public void foo() { int i; new Runnable() { public void run() { i = 10; } }; System.out.println(i); } Yes, it would compile, but it is useless... My point of view is if you want to have a statement then define another template which does assign the new runnable to a local variable.
Wontfix, workaround: > My point of view is if you want to have a statement then define another > template which does assign the new runnable to a local variable.
*** Bug 241653 has been marked as a duplicate of this bug. ***
We should really fix this.