Bug 194432 - IJavaProject.findType(String, String, WorkingCopyOwner) return the wrong duplicate element
Summary: IJavaProject.findType(String, String, WorkingCopyOwner) return the wrong dupl...
Status: VERIFIED DUPLICATE of bug 194399
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-26 10:48 EDT by David Audel CLA
Modified: 2007-09-18 06:46 EDT (History)
0 users

See Also:


Attachments
Test renamed and fixed with the correct expected type (1.78 KB, patch)
2007-08-14 08:52 EDT, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.