Community
Participate
Working Groups
When you auto-complete a method name in existing or copy-pasted code, Eclipse inserts an extra set of parentheses. SETUP You want to change the following method call to getLastName(): name = contact.getFirstName(); --------- 1. Delete the underlined code "FirstName" 2. Hit ctrl-space to show a list of getters 3. Select getLastName EXPECTED name = contact.getLastName(); ACTUAL name = contact.getLastName()(); FIX Only insert new parentheses if the next non-whitespace character is *not* an open parenthesis. TRICKY When Java 8 adds closures (I haven't checked the syntax yet) and allows them to be returned from methods, the ACTUAL code above becomes valid. 999 times out of 1,000 it won't be desired, but it'll be possible. I don't think that should affect this enhancement request, however.
The same happens with constructors: Start editing from: List<String> strings = new ArrayList<>(); Show completions on: List<String> strings = new link<>(); Select LinkedList() constructor: Expected: List<String> strings = new LinkedList<>(); Actual: List<String> strings = new LinkedList()<>();