This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
If I type a left paren, the editor puts in a right paren for me. This is good. If I finish typing the stuff in parens, and type a semicolon to finish the line, then the caret moves outside the right paren. That's good too. What's bad is the behavior with left brace. It should work like a semicolon, but doesn't. If I type a method header or while header, the left brace gets caught inside the parens: for (;;{) I keep tripping over this, and find it very awkward. A left brace should be treated like a semi, and skip past the closing right paren. Counting this as a defect because it is manifestly inconsistent with semicolon behavior.
I mostly agree with you but please note that the {} can be used for array contents initialization as well i.e. the following is also valid (though I agree that seldom used) pattern: Object o[] = { "a", "b" }; for (...; ...; o = new Object[] { "c", "d" }) { ... } I would still prefer to treat this as enhancement. In the future once we will have a local parsing available we should be able to treat the situation in the context-sensitive way which would IMHO be an optimal solution here.
Actually, I invented the anonymous array syntax, as well as the anonymous inner class syntax, in JDK 1.1. I'll extend the language lesson by pointing out that semicolons can occur inside expressions also, because of anonymous inner classes. In such cases the NB editor pops the semicolon into the wrong place. In the following example, the semicolon was typed after 'x' but moved to the end of the line: while (new Foo() { int x); As you say, these are rare cases. Even the case of iterating over an anonymous array is probably better stated using varargs, with no array initializers: for (String s : Arrays.asList("foo", "bar", "baz")) We agree that semis and braces are rare inside parentheses. In this bug I'm talking about the 99.999% case, where the semicolon or left brace goes to the end of the line. What I'm asking for is parity of treatment between semicolon and left-brace. My fingers are having a hard time learning the different typing rules. Thanks for listening.
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss