Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344376

Summary: Compiler does not honor build path order with library before source folder
Product: [Eclipse Project] JDT Reporter: Matt McCutchen <hashproduct+eclipse>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: CLOSED WONTFIX QA Contact:
Severity: minor    
Priority: P3 CC: amj87.iitr, satyam.kandula
Version: 3.7   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
Test case none

Description Matt McCutchen CLA 2011-04-30 11:54:30 EDT
Build Identifier: I20100727-1520

If a library precedes a source folder on the build path of a project, then the library should take precedence over the source folder whenever the JDT resolves a reference to a class in the project.  This works correctly for Ctrl-click navigation in the Java editor, but not for the compiler.  The compiler reports errors that indicate that it is trying to build against a class in the source folder even when a class of the same name exists in the library.

I'm setting the severity "minor" because this is a very unusual use case.

Reproducible: Always

Steps to Reproduce:
1. Import the archive file (to be attached).
2. Open Client.java.  Observe that Ctrl-clicking the call to doFoo takes you to the definition in the library, but a compile error is reported that is apparently based on the Foo class in the source folder (which does not contain the doFoo method).
Comment 1 Matt McCutchen CLA 2011-04-30 11:55:23 EDT
Created attachment 194424 [details]
Test case

This should be imported with "Import" -> "Existing Projects into Workspace".
Comment 2 Jay Arthanareeswaran CLA 2012-03-19 02:32:45 EDT
I don't know why would look for a type in another library entry when it's available in the current source entry that we are trying to compile. If we are talking about two different library folders, then definitely classpath order would be the deciding factor. But not in this case.

I am afraid we can't do much here. Satyam, can you please check and let me know what you think?
Comment 3 Satyam Kandula CLA 2012-03-29 04:37:01 EDT
JDT/Core is intentionally looking at the output folders before looking at the jars. This is good so that even if people don't really modify the class path ordering, the code in the source code will be resolved before the libraries. However, I agree that this is not correct. At the same time, I am afraid that this change could likely cause problems in some unknown scenarios. 

Matt, Do you really need this behavior?
Comment 4 Eclipse Genie CLA 2019-09-01 09:27:54 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.