View | Details | Raw Unified | Return to bug 120766
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/ResolveTests.java (+35 lines)
Lines 1948-1954 Link Here
1948
		deleteFile(new File(jarName));
1948
		deleteFile(new File(jarName));
1949
	}
1949
	}
1950
}
1950
}
1951
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=120766
1952
public void testDuplicateTypeDeclaration8() throws JavaModelException {
1953
	this.workingCopies = new ICompilationUnit[3];
1954
	this.workingCopies[0] = getWorkingCopy(
1955
		"/Resolve/src/test/Test.java",
1956
		"package test;"+
1957
		"public class Test {\n" + 
1958
		"  void foo() {\n" + 
1959
		"    test.p1.Type t = new test.p1.Type();\n" + 
1960
		"  }\n" + 
1961
		"}\n");
1962
	
1963
	this.workingCopies[1] = getWorkingCopy(
1964
		"/Resolve/src/test/p1/Type.java",
1965
		"package test.p1;"+
1966
		"public class Type {\n" + 
1967
		"  public Type(int i) {}\n" + 
1968
		"}\n");
1969
	
1970
	this.workingCopies[2] = getWorkingCopy(
1971
		"/Resolve/src/test/p2/Type.java",
1972
		"package test.p2;"+
1973
		"public class Type {\n" + 
1974
		"}\n");
1951
1975
1976
	String str = this.workingCopies[0].getSource();
1977
	int start = str.lastIndexOf("Type");
1978
	int length = "Type".length();
1979
	IJavaElement[] elements =  this.workingCopies[0].codeSelect(start, length, this.wcOwner);
1980
	
1981
	assertElementsEqual(
1982
			"Unexpected elements",
1983
			"Type [in [Working copy] Type.java [in test.p1 [in src [in Resolve]]]]",
1984
			elements
1985
	);
1986
}
1952
public void testArrayParameterInsideParent1() throws JavaModelException {
1987
public void testArrayParameterInsideParent1() throws JavaModelException {
1953
	ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArrayParameterInsideParent1.java");
1988
	ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArrayParameterInsideParent1.java");
1954
	
1989
	
(-)codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnQualifiedAllocationExpression.java (-4 / +19 lines)
Lines 61-71 Link Here
61
	public TypeBinding resolveType(BlockScope scope) {
61
	public TypeBinding resolveType(BlockScope scope) {
62
		super.resolveType(scope);
62
		super.resolveType(scope);
63
	
63
	
64
		// tolerate some error cases
64
		if (binding == null) {
65
		if (binding == null || 
66
				!(binding.isValidBinding() || 
67
					binding.problemId() == ProblemReasons.NotVisible))
68
			throw new SelectionNodeFound();
65
			throw new SelectionNodeFound();
66
		}
67
		
68
		// tolerate some error cases
69
		if (!binding.isValidBinding()) {
70
			switch (binding.problemId()) {
71
				case ProblemReasons.NotVisible:
72
					// visibility is ignored
73
					break;
74
				case ProblemReasons.NotFound:
75
					if (resolvedType != null && resolvedType.isValidBinding()) {
76
						throw new SelectionNodeFound(resolvedType);
77
					}
78
					throw new SelectionNodeFound();
79
				default:
80
					throw new SelectionNodeFound();
81
			}
82
		}
83
		
69
		if (anonymousType == null)
84
		if (anonymousType == null)
70
			throw new SelectionNodeFound(binding);
85
			throw new SelectionNodeFound(binding);
71
	
86
	

Return to bug 120766