### Eclipse Workspace Patch 1.0 #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.401 diff -u -r1.401 CompletionEngine.java --- codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 23 Jul 2009 05:08:58 -0000 1.401 +++ codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java 29 Jul 2009 09:04:01 -0000 @@ -1162,6 +1162,10 @@ break; } } + + if (isForbiddenType(packageName, simpleTypeName, enclosingTypeNames)) { + return; + } if(this.acceptedTypes == null) { this.acceptedTypes = new ObjectVector(); @@ -3791,13 +3795,22 @@ } TypeReference[] superInterfaces = typeDeclaration.superInterfaces; int length = superInterfaces == null ? 0 : superInterfaces.length; + int astNodeIndex = -1; for (int i = 0; i < length; i++) { if(superInterfaces[i] == astNode) { addForbiddenBindings(typeDeclaration.binding); addForbiddenBindingsForMemberTypes(typeDeclaration); - return scope.parent; + astNodeIndex = i; + break; } } + if (astNodeIndex >= 0) { + // Need to loop only up to astNodeIndex as the rest will be undefined. + for (int i = 0; i < astNodeIndex; i++) { + addForbiddenBindings(superInterfaces[i].resolvedType); + } + return scope.parent; + } } else { if (astNodeParent != null && astNodeParent instanceof TryStatement) { boolean isException = false; @@ -11701,6 +11714,24 @@ return false; } + private boolean isForbiddenType(char[] givenPkgName, char[] givenTypeName, char[][] enclosingTypeNames) { + // CharOperation.concatWith() handles the cases where input args are null/empty + char[] fullTypeName = CharOperation.concatWith(enclosingTypeNames, givenTypeName, '.'); + for (int i = 0; i <= this.forbbidenBindingsPtr; i++) { + if (this.forbbidenBindings[i] instanceof TypeBinding) { + TypeBinding typeBinding = (TypeBinding) this.forbbidenBindings[i]; + char[] currPkgName = typeBinding.qualifiedPackageName(); + if (CharOperation.equals(givenPkgName, currPkgName)) { + char[] currTypeName = typeBinding.qualifiedSourceName(); + if (CharOperation.equals(fullTypeName, currTypeName)) { + return true; + } + } + } + } + return false; + } + private boolean isIgnored(int kind) { return this.requestor.isIgnored(kind); }