Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 338154

Summary: [typing] "Automatically close <angle> brackets" should not add > when type argument follows
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: TextAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert
Version: 3.7   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fix & Test none

Description Markus Keller CLA 2011-02-24 15:42:28 EST
HEAD

The "Automatically close <angle> brackets" feature from the Typing preference page should not add the closing > when it is already present. This already works fine for (parentheses):

import java.util.*;

public class Try {
    void foo(Object o) {
        List<String> var= new ArrayList|String>();
        foo|var);
    }
}

When you replace the "|" with "<" and "(", respectively, then you see the good behavior for "(" and the bad additional ">" that gets inserted after the "<".
Comment 1 Markus Keller CLA 2011-02-24 16:59:33 EST
Created attachment 189751 [details]
Fix & Test

I took a look at the implementation and saw that it's not as easy as counting brackets.

A strategy that better suits editing in 1.5 code is to avoid closing angle brackets if the token following the caret location is the start of a valid type argument.
Comment 2 Markus Keller CLA 2011-02-24 17:00:40 EST
Fixed in HEAD.
Comment 3 Dani Megert CLA 2011-02-25 04:07:46 EST
Thanks.