### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java,v retrieving revision 1.84 diff -u -r1.84 CompletionTests_1_5.java --- src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 26 Apr 2007 11:27:42 -0000 1.84 +++ src/org/eclipse/jdt/core/tests/model/CompletionTests_1_5.java 24 May 2007 13:38:47 -0000 @@ -1997,7 +1997,7 @@ " public static void ZZZ2(int i) {}\n"+ "}"); - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true); ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0072", "Test.java"); String str = cu.getSource(); @@ -2005,10 +2005,16 @@ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); cu.codeComplete(cursorLocation, requestor, this.wcOwner); + int end1 = cursorLocation; + int start1 = end1 - "ZZ".length(); + + int end2 = cursorLocation; + int start2 = end2 - "test0072.p.ImportedClass.ZZ".length(); + assertResults( - "ZZZ1[FIELD_REF]{test0072.p.ImportedClass.ZZZ1;, Ltest0072.p.ImportedClass;, I, ZZZ1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, ()V, ZZZ2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, (I)V, ZZZ2, (i), " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "ZZZ1[FIELD_REF]{ZZZ1;, Ltest0072.p.ImportedClass;, I, ZZZ1, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, ()V, ZZZ2, null, ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "ZZZ2[METHOD_IMPORT]{test0072.p.ImportedClass.ZZZ2;, Ltest0072.p.ImportedClass;, (I)V, ZZZ2, (i), ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { if(importedClass != null) { @@ -2034,7 +2040,7 @@ " }\n"+ "}"); - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true); ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0073", "Test.java"); String str = cu.getSource(); @@ -2042,10 +2048,16 @@ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); cu.codeComplete(cursorLocation, requestor, this.wcOwner); + int end1 = cursorLocation; + int start1 = end1 - "ZZ".length(); + + int end2 = cursorLocation; + int start2 = end2 - "test0073.p.ImportedClass.Inner.ZZ".length(); + assertResults( - "ZZZ1[FIELD_REF]{test0073.p.ImportedClass.Inner.ZZZ1;, Ltest0073.p.ImportedClass$Inner;, I, ZZZ1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, ()V, ZZZ2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "ZZZ1[FIELD_REF]{ZZZ1;, Ltest0073.p.ImportedClass$Inner;, I, ZZZ1, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, ()V, ZZZ2, null, ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "ZZZ2[METHOD_IMPORT]{test0073.p.ImportedClass.Inner.ZZZ2;, Ltest0073.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { if(importedClass != null) { @@ -2071,7 +2083,7 @@ " }\n"+ "}"); - CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true); + CompletionTestsRequestor2 requestor = new CompletionTestsRequestor2(true, false, true); ICompilationUnit cu= getCompilationUnit("Completion", "src3", "test0074", "Test.java"); String str = cu.getSource(); @@ -2079,10 +2091,16 @@ int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length(); cu.codeComplete(cursorLocation, requestor, this.wcOwner); + int end1 = cursorLocation; + int start1 = end1 - "ZZ".length(); + + int end2 = cursorLocation; + int start2 = end2 - "test0074.p.ImportedClass.Inner.ZZ".length(); + assertResults( - "ZZZ1[FIELD_REF]{test0074.p.ImportedClass.Inner.ZZZ1;, Ltest0074.p.ImportedClass$Inner;, I, ZZZ1, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, ()V, ZZZ2, null, " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + - "ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", + "ZZZ1[FIELD_REF]{ZZZ1;, Ltest0074.p.ImportedClass$Inner;, I, ZZZ1, null, ["+start1+", "+end1+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, ()V, ZZZ2, null, ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}\n" + + "ZZZ2[METHOD_IMPORT]{test0074.p.ImportedClass.Inner.ZZZ2;, Ltest0074.p.ImportedClass$Inner;, (I)V, ZZZ2, (i), ["+start2+", "+end2+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_CASE + R_NON_RESTRICTED) + "}", requestor.getResults()); } finally { if(importedClass != null) { @@ -7373,10 +7391,10 @@ result.context); int end = result.cursorLocation; - int start = end - "test0223.AType.va".length(); + int start = end - "va".length(); assertResults( - "VAR[FIELD_REF]{test0223.AType.VAR;, Ltest0223.AType;, I, VAR, null, ["+start+", "+end+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}", + "VAR[FIELD_REF]{VAR;, Ltest0223.AType;, I, VAR, null, ["+start+", "+end+"], " + (R_DEFAULT + R_RESOLVED + R_INTERESTING + R_NON_RESTRICTED) + "}", result.proposals); } finally { if(paramClass1 != null) { #P org.eclipse.jdt.core Index: codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java,v retrieving revision 1.328 diff -u -r1.328 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 14 May 2007 17:04:00 -0000 1.328 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 24 May 2007 13:38:51 -0000 @@ -2028,7 +2028,10 @@ } if(importReference.isStatic()) { if(!this.requestor.isIgnored(CompletionProposal.FIELD_REF)) { + long positions = importReference.sourcePositions[importReference.sourcePositions.length - 1]; + setSourceRange((int) (positions >>> 32), (int) positions); this.findImportsOfStaticFields(lastToken, ref); + setSourceRange(importReference.sourceStart, importReference.declarationSourceEnd); } if(!this.requestor.isIgnored(CompletionProposal.METHOD_NAME_REFERENCE)) { this.findImportsOfStaticMethods(lastToken, ref); @@ -3939,14 +3942,7 @@ && !field.canBeSeenBy(this.unitScope.fPackage)) continue next; - char[] completionName = CharOperation.concat( - field.declaringClass.qualifiedPackageName(), - '.', - field.declaringClass.qualifiedSourceName(), - '.', - field.name); - - completionName = CharOperation.concat(completionName, SEMICOLON); + char[] completionName = CharOperation.concat(field.name, SEMICOLON); int relevance = computeBaseRelevance(); relevance += computeRelevanceForResolution();