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

(-)src/org/eclipse/jdt/core/tests/model/ResolveTests.java (+50 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.model;
11
package org.eclipse.jdt.core.tests.model;
12
12
13
import java.io.File;
13
import java.io.IOException;
14
import java.io.IOException;
14
15
15
import org.eclipse.core.runtime.CoreException;
16
import org.eclipse.core.runtime.CoreException;
17
import org.eclipse.core.runtime.Path;
16
import org.eclipse.jdt.core.*;
18
import org.eclipse.jdt.core.*;
17
19
18
import junit.framework.*;
20
import junit.framework.*;
Lines 1899-1904 Link Here
1899
			elements
1901
			elements
1900
	);
1902
	);
1901
}
1903
}
1904
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=119434
1905
public void testDuplicateTypeDeclaration7() throws CoreException, IOException {
1906
	String jarName = "bug119434.jar";
1907
	try {
1908
		String[] pathAndContents = new String[] {
1909
			"test/p/Type.java",
1910
			"package test.p;"+
1911
			"public class Type {\n" + 
1912
			"}\n"
1913
		};
1914
		
1915
		addLibrary(jarName, "bug119434_src.zip", pathAndContents, JavaCore.VERSION_1_4);
1916
		
1917
		this.workingCopies = new ICompilationUnit[2];
1918
		this.workingCopies[0] = getWorkingCopy(
1919
			"/Resolve/src/test/Test.java",
1920
			"package test;"+
1921
			"import test.p.Type;"+
1922
			"public class Test {\n" + 
1923
			"}\n");
1924
		
1925
		this.workingCopies[1] = getWorkingCopy(
1926
			"/Resolve/src/test/p/Type.java",
1927
			"package test.p;"+
1928
			"public class Type {\n" + 
1929
			"}\n");
1930
		
1931
		String str = this.workingCopies[0].getSource();
1932
		int start = str.lastIndexOf("Type");
1933
		int length = "Type".length();
1934
		IJavaElement[] elements =  this.workingCopies[0].codeSelect(start, length, this.wcOwner);
1935
		
1936
		
1937
		// The result should be "Type [in Type.class [in test.p [in src [in Resolve]]]]" but it is
1938
		// currently "Type [in Type.class [in test.p [in bug119434.jar [in Resolve]]]]". 
1939
		// This is caused by the bug 194432
1940
		// This test must be updated once bug 194432 will be fixed
1941
		assertElementsEqual(
1942
				"Unexpected elements",
1943
				"Type [in Type.class [in test.p [in bug119434.jar [in Resolve]]]]",
1944
				elements
1945
		);
1946
	} finally {
1947
		removeLibraryEntry(this.currentProject, new Path(jarName));
1948
		deleteFile(new File(jarName));
1949
	}
1950
}
1951
1902
public void testArrayParameterInsideParent1() throws JavaModelException {
1952
public void testArrayParameterInsideParent1() throws JavaModelException {
1903
	ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArrayParameterInsideParent1.java");
1953
	ICompilationUnit cu = getCompilationUnit("Resolve", "src", "", "ResolveArrayParameterInsideParent1.java");
1904
	
1954
	
(-)model/org/eclipse/jdt/internal/core/SelectionRequestor.java (+7 lines)
Lines 743-748 Link Here
743
 */
743
 */
744
protected void addElement(IJavaElement element) {
744
protected void addElement(IJavaElement element) {
745
	int elementLength = this.elementIndex + 1;
745
	int elementLength = this.elementIndex + 1;
746
	
747
	for (int i = 0; i < elementLength; i++) {
748
		if (this.elements[i].equals(element)) {
749
			return;
750
		}
751
	}
752
	
746
	if (elementLength == this.elements.length) {
753
	if (elementLength == this.elements.length) {
747
		System.arraycopy(this.elements, 0, this.elements = new IJavaElement[(elementLength*2) + 1], 0, elementLength);
754
		System.arraycopy(this.elements, 0, this.elements = new IJavaElement[(elementLength*2) + 1], 0, elementLength);
748
	}
755
	}

Return to bug 119434