### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests.java,v retrieving revision 1.203 diff -u -r1.203 CompletionTests.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests.java 7 May 2009 08:49:30 -0000 1.203 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests.java 14 May 2009 13:25:36 -0000 @@ -20102,4 +20102,58 @@ requestor.getResults()); } +/** + * An inner/member class should not be offered as completion suggestion. + * @throws JavaModelException + */ +public void test270437a() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test270437a.java", + "package test;" + + "public class Test270437a extends Test270437a. {\n" + + " public class Inner {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "Test270437a."; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + + // In the absence of the fix, the results would be as follows, which is wrong: + //"Test270437a.Inner[TYPE_REF]{Inner, test, Ltest.Test270437a$Inner;, null, 39}", + assertResults( + "", //Empty! + requestor.getResults()); +} + +/** + * An inner/member interface should not be offered as completion suggestion. + * @throws JavaModelException + */ +public void test270437b() throws JavaModelException { + this.workingCopies = new ICompilationUnit[1]; + this.workingCopies[0] = getWorkingCopy( + "/Completion/src/test/Test270437b.java", + "package test;" + + "public class Test270437b implements Test270437b. {\n" + + " public interface Inner {}\n" + + "}\n"); + + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(); + String str = this.workingCopies[0].getSource(); + String completeBehind = "Test270437b."; + int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); + + this.workingCopies[0].codeComplete(cursorLocation, requestor, this.wcOwner); + + // In the absence of the fix, the results would be as follows, which is wrong: + //"Test270437b.Inner[TYPE_REF]{Inner, test, Ltest.Test270437b$Inner;, null, 39}", + assertResults( + "", //Empty! + requestor.getResults()); +} + }