Bug 194432

Summary: IJavaProject.findType(String, String, WorkingCopyOwner) return the wrong duplicate element
Product: [Eclipse Project] JDT Reporter: David Audel <david_audel>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.3   
Target Milestone: 3.4 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Test renamed and fixed with the correct expected type none

Description David Audel CLA 2007-06-26 10:48:06 EDT
build 3.3RC4

Add the following test in org.eclipse.jdt.core.tests.model.ResolveTests.

public void testONLY_Bug() throws CoreException, IOException {
	String jarName = "bug119434.jar";
	try {
		String[] pathAndContents = new String[] {
			"test/p/Type.java",
			"package test.p;"+
			"public class Type {\n" + 
			"}\n"
		};
		
		addLibrary(jarName, "bug119434_src.zip", pathAndContents, JavaCore.VERSION_1_4);
		
		this.workingCopies = new ICompilationUnit[1];
		this.workingCopies[0] = getWorkingCopy(
			"/Resolve/src/test/p/Type.java",
			"package test.p;"+
			"public class Type {\n" + 
			"}\n");
		
		IJavaProject javaProject = this.getJavaProject("Resolve");

        IType foundType = javaProject.findType("test.p", "Type", this.wcOwner);

        assertElementEquals(
                        "Unexpected elements",
                        "Type [in Type.class [in test.p [in bug119434.jar [in Resolve]]]]",
                        foundType);
	} finally {
		removeLibraryEntry(this.currentProject, new Path(jarName));
		deleteFile(new File(jarName));
	}
}

'Type [in Type.class [in test.p [in src [in Resolve]]]]' should be returned instead of 'Type [in Type.class [in test.p [in bug119434.jar [in Resolve]]]]' because 'src' is before 'bug119434.jar' on the classpath.
Comment 1 Jerome Lanneluc CLA 2007-08-14 08:52:22 EDT
Created attachment 76036 [details]
Test renamed and fixed with the correct expected type
Comment 2 Jerome Lanneluc CLA 2007-08-14 08:53:38 EDT
Fix for bug 194399 actually fixes this bug.
Test released in HEAD.

*** This bug has been marked as a duplicate of bug 194399 ***
Comment 3 Frederic Fusier CLA 2007-09-18 06:46:00 EDT
Verified for 3.4 M2 using build I20070917-0010.