Project: JDT
Bug 298426 [content assist] constructor completion with package prefix fails
Reported: 2009-12-22 13:38:54 | Status: verified fixed

Build Identifier: M20090917-0800 I have some code that uses JAXB. There are several places where I instantiate an ObjectFactory to create some related objects. As I'm using more than one ObjectFactory in a class, I specify the FQCN for the ObjectFactory, which is a little annoying. So, I figure I should be able to use completion to save some keystrokes. I enter "new" followed by the beginning of the package path, and that nicely lets me complete the rest of the package path. I then enter "." (period) and that brings up the completion menu at that point. The menu has three items, consisting of "ObjectFactory()", the class name the ObjectFactory would be creating, and the constructor for the class name. In any case, "ObjectFactory" is the first one in the list, and it's highlighted, so I just press Enter, as that's the one I want. What I get with that is ... nothing. When I pressed Enter on the menu, it didn't insert "ObjectFactory()". It didn't insert anything. I then manually enter "ObjectFactory()" and then ".". It then brings up the completion menu for the methods of that ObjectFactory. I select the one I want and it inserts it. I've tried this numerous times, and it never inserts "ObjectFactory()". I tried a similar scenario with a class that I wrote (in a related package to the class I'm referencing it from), so I enter "new", followed by the initial piece of the package path, followed by Ctrl-space. I select the package I want from the menu, and it inserts the rest of the package path. I then enter ".", and that brings up the completion menu listing the constructors for the classes in that package. I select the one I want and it inserts it, no problem. I don't know what could be different about the ObjectFactory class that could cause this symptom. It's a class name that would occur multiple times in the classpath, but obviously only once in each package. I don't have the source for it, but I do have the source for the other completion test case I tried. Reproducible: Always

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/JavaMethodCompletionProposal.java