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.

Bug 257375

Summary: Ignore user input for closing parentheses, when they have already been generated
Product: java Reporter: lukas.eder
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description lukas.eder 2016-01-03 18:44:20 UTC
I'm currently evaluating NetBeans against Eclipse. One awesome thing that Eclipse does and NetBeans doesn't is this:

- I'm typing a method call "A.method("
- Both Eclipse and Netbeans auto-close the parenthesis to "A.method()"

Now, this is great in case the parenthesis gets forgotten. But I often WANT to type the parenthesis, because that's how I think about code. So, when I do type it, here's the output (cursor illustrated as |) 

- For Eclipse: Still "A.method()|"
- For Netbeans: "A.method())|"

That's rather annoying, and if I don't notice, and I'm deeply nesting lambdas and chained method calls, it's very hard to debug the excess parenthesis.

It would be great if closing parentheses are ignored iff:

- I have just typed an open parenthesis
- Netbeans has auto-generated the closing parenthesis
- I have not typed anything else in the meantime
Comment 1 lukas.eder 2016-01-03 19:46:09 UTC
In fact, this doesn't always happen, but it seems to happen very often in the code I'm currently writing. Here's a way to reproduce the issue:

------------------------------------------
public class Test {
    public void x() {
        assertEquals(
            asList(
                new BigDecimal
            )
        )
    }
}
------------------------------------------

Now, place the cursor after "BigDecimal" and type "()". The result is:


------------------------------------------
public class Test {
    public void x() {
        assertEquals(
            asList(
                new BigDecimal())
            )
        )
    }
}
------------------------------------------
Comment 2 peathal 2016-01-27 20:18:24 UTC
This indeed looks like a bug to me and I can reproduce it with 8.0.2. Normally this just works as you say. E.g. this works:

public class Test {
    public void x() {
        new BigDecimal
    }
}