Bug 231293 - New errors about indirectly referenced classes from required .class files in 20080508-200
Summary: New errors about indirectly referenced classes from required .class files in ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC1   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-05-09 09:14 EDT by Ed Merks CLA
Modified: 2008-05-14 03:15 EDT (History)
3 users (show)

See Also:
philippe_mulet: review+


Attachments
A tiny project with the problem (3.77 KB, application/zip)
2008-05-09 09:14 EDT, Ed Merks CLA
no flags Details
Proposed patch (1.97 KB, patch)
2008-05-12 13:27 EDT, Kent Johnson CLA
no flags Details | Diff
Same patch but added testcase (5.14 KB, patch)
2008-05-13 11:10 EDT, Kent Johnson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Merks CLA 2008-05-09 09:14:02 EDT
The attached project builds correctly with M7 but produces errors about not being able to find org.eclipse.core.expressions.expression. It appears to be related to the fact that there are overloaded methods some of which refer to Expression which isn't available unless you actually depend on its plugin directly.

The GMF source code has two such problems.  Another one occurs when it uses org.apache.batik.dom.util.DOMUtilities.deepCloneDocument (as static) where DOMUtilities extends XMLUtilities, which is not available on the classpath.  This seems similar but a bit different.
Comment 1 Ed Merks CLA 2008-05-09 09:14:44 EDT
Created attachment 99454 [details]
A tiny project with the problem
Comment 2 Ed Merks CLA 2008-05-09 09:21:55 EDT
Rich,

The GMF code is affected by this issue.  
Comment 3 Jerome Lanneluc CLA 2008-05-12 05:43:10 EDT
This behavior was introduced with the fix to bug 214558. Reverting this fix makes the project build with no error.

Note that the project's classpath is incomplete. But it seems that we are less lazy than before. Thus we ask for types that are not on the classpath.
Comment 4 Philipe Mulet CLA 2008-05-12 05:49:28 EDT
Fix for bug 214558 is necessary though. We used to select exact matches, and sometimes bind to the wrong method. In essence, we should have been selecting amongst several methods and not just one; inducing some more resolutions than wanted.

Kent - pls check that Ed's scenario indeed does involve raw types. Also could we simply ignore methods with are not resolvable ? (ignore them from lookup semantics so as to reduce secondary errors).
Comment 5 Kent Johnson CLA 2008-05-12 12:23:14 EDT
There are no raw types involved in the example.

If we want to maintain the same level of laziness as far as type resolution is concerned, then I suggest we change findExactMethod in Scope, which was released for bug 214558 to be:

public MethodBinding findExactMethod(ReferenceBinding receiverType, ...) {
	CompilationUnitScope unitScope = compilationUnitScope();
	unitScope.recordTypeReferences(argumentTypes);
	MethodBinding exactMethod = receiverType.getExactMethod(selector...	if (exactMethod != null && exactMethod.typeVariables...) {
		// in >= 1.5 mode, ensure the exactMatch did not match raw types
		if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5)
			for (int i = argumentTypes.length; --i >= 0;)
				if (argumentTypes[i].isRawType())
					return null;


Philippe, +1 ?
Comment 6 Kent Johnson CLA 2008-05-12 13:27:53 EDT
Created attachment 99757 [details]
Proposed patch
Comment 7 Philipe Mulet CLA 2008-05-13 05:47:59 EDT
+1 for 3.4RC1
Comment 8 Kent Johnson CLA 2008-05-13 11:10:58 EDT
Created attachment 99964 [details]
Same patch but added testcase
Comment 9 Kent Johnson CLA 2008-05-13 11:12:54 EDT
Released for 3.4RC1

Added Java50Tests.testMissingRequiredBinaries()
Comment 10 Maxime Daniel CLA 2008-05-14 03:15:03 EDT
Verified for 3.4 RC1 using build I20080513-2000.