Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338154 - [typing] "Automatically close <angle> brackets" should not add > when type argument follows
Summary: [typing] "Automatically close <angle> brackets" should not add > when type ar...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-24 15:42 EST by Markus Keller CLA
Modified: 2011-02-25 04:07 EST (History)
1 user (show)

See Also:


Attachments
Fix & Test (4.42 KB, patch)
2011-02-24 16:59 EST, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.