Community
Participate
Working Groups
I have a class with inner interface in package "pkg1": package pkg1; public class ClassWithInnerInterface { public void method(Interface ifc) { } public static interface Interface { } } Now, in a class in another package, I want to create an instance of that interface, as anonymous class: public class TestClass { public static void main(String[] args) { new Interfac } } After typing "new Interfac", nothing is offered to completion. If the Interface interface was in a separate class, i will offer to create anonymous inner type. An code assist is, however, offered, if you call a method with Interface parameter, such as the "method" method in the above class: import pkg1.ClassWithInnerInterface; public class TestClass { public static void main(String[] args) { ClassWithInnerInterface o = new ClassWithInnerInterface(); o.method(new Inter) } } However, no import of "pkg1.ClassWithInnerInterface.Interface" is added and a compilation error appears. Reproduces in 3.8.1 as well. This inner interfaces are used for widget listeners in Vaadin framework, I enter into it quite frequently.
Reproduced with HEAD, and all the way back to 3.6. I am afraid we won't be able to get to this any time soon. Anyone willing to take this up and post a patch is welcome, though!
I did a little bit of research about this one. Seems like the bug is inside CompletionEngine.findTypesAndPackages. This method does not find the interface inside the class. There seem to be more related bugs to this method. Writing the name of the interface fully ("new Interface") and pressing CTRL+1 does not propose to import the missing name (the call also ends up in this method but is not able to detect the nested interface). Interestingly organize import does add the import as expected (guess there is a second implementation of this functionality used by organize imports functionality only). Additional observation: setting local variable "proposeAllMemberTypes" to "true" in debugger leads CTRL+1 to work and return the correct import (but autocompletion is then still broken).
I spent some time investigating this and figured that the index is not returning the inner types when the assist request is for constructors: org.eclipse.jdt.core.search.SearchPattern.findIndexMatches(Index, IndexQueryRequestor, SearchParticipant, IJavaSearchScope, IProgressMonitor) Also note that when we don't have the 'new' the proposal appears. That's because the 'proposeType' is set to true and proposeConstructor set to false, which results in type being found from the name environment. Manoj, can you please comment on this? Note: Manoj is on vacation and could only respond after middle of Nov.
missed this out - moving to 4.7
Bulk move out of 4.8
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.