| Summary: | [quick fix] 'Add unimplemented methods' adds two methods from its implementing interface when one is already there | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Remy Suen <remy.suen> | ||||
| Component: | UI | Assignee: | Markus Keller <markus.kell.r> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | daniel_megert | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7 M4 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Markus, this looks like a bug in org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.getUnimplementedMethods(ITypeBinding, boolean). Created attachment 183874 [details]
Fix
Yeah, it's one of those hairy areas where we have to play type rules and we don't have enough APIs from the compiler...
Fixed in HEAD. Thanks for the small snippets, Remy! I stole them for the regression test. |
I20101102-0800 1. Make a new Java 5 project. 2. Make one file. import java.util.List; public interface EModelService { public <T> List<T> findElements(Class<T> clazz, List<String> tagsToMatch); public <T> List<T> findPerspectiveElements(Class<T> clazz, List<String> tagsToMatch); } 3. Make another file. This one will have errors. import java.util.List; public class ModelServiceImpl implements EModelService { public <T> List<T> findElements(Class<T> clazz, List<String> tagsToMatch) { return null; } } 4. Use Ctrl+1 to ask JDT to add the unimplemented methods. 5. Now I have three methods. import java.util.List; public class ModelServiceImpl implements EModelService { public <T> List<T> findElements(Class<T> clazz, List<String> tagsToMatch) { return null; } public <T> List<T> findElements(Class<T> clazz, List<String> tagsToMatch) { // TODO Auto-generated method stub return null; } public <T> List<T> findPerspectiveElements(Class<T> clazz, List<String> tagsToMatch) { // TODO Auto-generated method stub return null; } }