Community
Participate
Working Groups
Version: 3.5.0 Build id: I20090313-0100 1. Test case: public class TestClass extends TestClass.Inn|{ public class Inner {} } 2. At the '|' symbol do CTRL+Space 3. 'TestClass.Inn' gets completed to TestClass.Inner - which is wrong since it leads to an error: "Cycle detected: the type TestClass cannot extend/implement itself or one of its own member types"
Created attachment 136016 [details] Code plugin patch - v-0.5 Patch for org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java
Created attachment 136017 [details] Tests plugin patch - v-0.5 Patch for org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java
The same issue is applicable to interfaces as well. That is, inner/member interfaces are offered as completion choices for implements too. The attached code patch fixes both the issues - the originally reported extends issue and the one I noticed about implements as well. The attached test patch has two tests to verify the two problems addressed by this code patch.
The patch filter member types of the completed type but not members of members eg. class X extends X.MyClass1.MyClass| { // do ctrl+space at | public class MyClass1 { public class MyClass2 { } } } MyClass2 should not be proposed
Created attachment 142042 [details] Code plugin patch - v-0.6 Updated the code patch to recursively add member types as forbidden.
Created attachment 142043 [details] Tests plugin patch - v-0.6 Add a test to catch the issue pointed out by David where nested member types were identified for completion. This patch contains three tests in all including the two tests added previously.
(In reply to comment #4) > The patch filter member types of the completed type but not members of members Yes, Srikanth too pointed out during his review. The newer patch takes care of this. It was just a matter of making the process recursive. Added an additional JUnit test case as well.
(In reply to comment #7) > (In reply to comment #4) > > The patch filter member types of the completed type but not members of members > Yes, Srikanth too pointed out during his review. The newer patch takes care of > this. It was just a matter of making the process recursive. Added an additional > JUnit test case as well. The fix and tests look reasonable. Could you please regenerate the patch after syncronizing with HEAD and repost ? Thanks.
Created attachment 142113 [details] Code plugin patch - v-0.7 Patch to CompletionEngine.java in org.eclipse.jdt.core plugin after synchronizing with HEAD.
Created attachment 142114 [details] Tests plugin patch - v-0.7 Patch to CompletionTests.java in org.eclipse.jdt.core.tests.model plugin after synchronizing with HEAD.
Released in HEAD for 3.6M1
Verified for 3.6M1 using build 20090802-2000.