Bug 194399 - IJavaProject.findType(String, String, WorkingCopyOwner) doesn't return the same element with different VMs.
Summary: IJavaProject.findType(String, String, WorkingCopyOwner) doesn't return the sa...
Status: VERIFIED FIXED
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:
: 194432 202152 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-06-26 07:36 EDT by David Audel CLA
Modified: 2007-09-18 12:59 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix and regression test (6.76 KB, patch)
2007-08-14 06:00 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 07:36:34 EDT
build 3.3RC4

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

public void testONLY_Bug() throws JavaModelException {
	this.workingCopies = new ICompilationUnit[2];
	this.workingCopies[0] = getWorkingCopy(
		"/Resolve/src/test/p/Type.java",
		"package test.p;"+
		"public class Type {\n" + 
		"}\n");
	
	this.workingCopies[1] = getWorkingCopy(
		"/Resolve/src2/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 [Working copy] Type.java [in test.p [in src2 [in Resolve]]]]",
			foundType);
}

When i run the test with the vm of jdk1.5.0_12 then 'Type [in [Working copy] Type.java [in test.p [in src2 [in Resolve]]]]' is returned.

When i run the test with the vm of jdk1.5.0_08 then 'Type [in [Working copy] Type.java [in test.p [in src [in Resolve]]]]' is returned.


The result should be always the same and the first type on the classpath would be better.
Comment 1 David Audel CLA 2007-06-26 07:39:43 EDT
The problem is that the order of JavaModelManager.getWorkingCopies(....) result is not the same in both case.
Comment 2 Jerome Lanneluc CLA 2007-06-26 09:22:03 EDT
See also bug 169970
Comment 3 Jerome Lanneluc CLA 2007-08-14 06:00:21 EDT
Created attachment 76031 [details]
Proposed fix and regression test

The test given by David has been renamed to testWorkingCopyOrder1()
Comment 4 Jerome Lanneluc CLA 2007-08-14 08:45:24 EDT
Fix and test released for 3.4M2 in HEAD.
Comment 5 Jerome Lanneluc CLA 2007-08-14 08:53:38 EDT
*** Bug 194432 has been marked as a duplicate of this bug. ***
Comment 6 Jerome Lanneluc CLA 2007-09-04 10:16:37 EDT
*** Bug 202152 has been marked as a duplicate of this bug. ***
Comment 7 Georgi Vachkov CLA 2007-09-18 02:42:06 EDT
Hi Jerome,

We are using Eclipse 3.3 and we are developing some web service related plugins
in Eclipse. This bug creates limitations in our functionality - for example the user is not able to generate twice same java bean skeleton out of WSDL in different projects. I would like to request this bug to be fixed in 3.3.
I am from SAP LAbs Bulgaria and for us this is a real problem.

thanks and regards,
Georgi
Comment 8 Frederic Fusier CLA 2007-09-18 06:45:30 EDT
Verified for 3.4 M2 using build I20070917-0010.
Comment 9 Jerome Lanneluc CLA 2007-09-18 12:59:21 EDT
(In reply to comment #7)
Sorry but the fix is not straight forward and since this is not a regression in 3.3 (the problem existed in 3.2 and before), we have no plan to backport it.