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.
Summary: | awkward left brace after left paren | ||
---|---|---|---|
Product: | editor | Reporter: | jrose <jrose> |
Component: | Key bindings | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED WONTFIX | ||
Severity: | blocker | ||
Priority: | P3 | ||
Version: | 5.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
jrose
2005-10-28 22:28:49 UTC
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 |