View | Details | Raw Unified | Return to bug 276526 | Differences between
and this patch

Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java (-1 / +32 lines)
Lines 1162-1167 Link Here
1162
					break;
1162
					break;
1163
			}
1163
			}
1164
		}
1164
		}
1165
		
1166
		if (isForbiddenType(packageName, simpleTypeName, enclosingTypeNames)) {
1167
			return;
1168
		}
1165
1169
1166
		if(this.acceptedTypes == null) {
1170
		if(this.acceptedTypes == null) {
1167
			this.acceptedTypes = new ObjectVector();
1171
			this.acceptedTypes = new ObjectVector();
Lines 3791-3803 Link Here
3791
			}
3795
			}
3792
			TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
3796
			TypeReference[] superInterfaces = typeDeclaration.superInterfaces;
3793
			int length = superInterfaces == null ? 0 : superInterfaces.length;
3797
			int length = superInterfaces == null ? 0 : superInterfaces.length;
3798
			int astNodeIndex = -1;
3794
			for (int i = 0; i < length; i++) {
3799
			for (int i = 0; i < length; i++) {
3795
				if(superInterfaces[i] == astNode) {
3800
				if(superInterfaces[i] == astNode) {
3796
					addForbiddenBindings(typeDeclaration.binding);
3801
					addForbiddenBindings(typeDeclaration.binding);
3797
					addForbiddenBindingsForMemberTypes(typeDeclaration);
3802
					addForbiddenBindingsForMemberTypes(typeDeclaration);
3798
					return scope.parent;
3803
					astNodeIndex = i;
3804
					break;
3799
				}
3805
				}
3800
			}
3806
			}
3807
			if (astNodeIndex >= 0) {
3808
				// Need to loop only up to astNodeIndex as the rest will be undefined.
3809
				for (int i = 0; i < astNodeIndex; i++) {
3810
					addForbiddenBindings(superInterfaces[i].resolvedType);
3811
				}
3812
				return scope.parent;
3813
			}
3801
		} else {
3814
		} else {
3802
			if (astNodeParent != null && astNodeParent instanceof TryStatement) {
3815
			if (astNodeParent != null && astNodeParent instanceof TryStatement) {
3803
				boolean isException = false;
3816
				boolean isException = false;
Lines 11701-11706 Link Here
11701
		return false;
11714
		return false;
11702
	}
11715
	}
11703
11716
11717
	private boolean isForbiddenType(char[] givenPkgName, char[] givenTypeName, char[][] enclosingTypeNames) {
11718
		// CharOperation.concatWith() handles the cases where input args are null/empty
11719
		char[] fullTypeName = CharOperation.concatWith(enclosingTypeNames, givenTypeName, '.');
11720
		for (int i = 0; i <= this.forbbidenBindingsPtr; i++) {
11721
			if (this.forbbidenBindings[i] instanceof TypeBinding) {
11722
				TypeBinding typeBinding = (TypeBinding) this.forbbidenBindings[i];
11723
				char[] currPkgName = typeBinding.qualifiedPackageName();
11724
				if (CharOperation.equals(givenPkgName, currPkgName))	{
11725
					char[] currTypeName = typeBinding.qualifiedSourceName();
11726
					if (CharOperation.equals(fullTypeName, currTypeName)) {
11727
						return true;
11728
					}
11729
				}
11730
			}
11731
		}
11732
		return false;
11733
	}
11734
11704
	private boolean isIgnored(int kind) {
11735
	private boolean isIgnored(int kind) {
11705
		return this.requestor.isIgnored(kind);
11736
		return this.requestor.isIgnored(kind);
11706
	}
11737
	}

Return to bug 276526