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

Bug 369688

Summary: Non-Exported jars are imported
Product: [Eclipse Project] JDT Reporter: Marvin Fröhlich <eclipse>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, paul.brady, satyam.kandula, stephan.herrmann
Version: 3.7.1   
Target Milestone: 3.8 M6   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Marvin Fröhlich CLA 2012-01-25 10:55:49 EST
Build Identifier: 20110916-0149

I have two projects.
Project A imports some jars j.jar and k.jar.
Nothing but project A's source is exported under "Order and Export".
Project B imports project A.
The following command executed from within B, which is run through a launch configuration:
System.err.println( System.getProperty( "java.class.path" ) );
includes j.jar and k.jar from project A.

Reproducible: Always
Comment 1 Stephan Herrmann CLA 2012-01-26 08:39:56 EST
(In reply to comment #0)
> Build Identifier: 20110916-0149
> 
> I have two projects.
> Project A imports some jars j.jar and k.jar.
> Nothing but project A's source is exported under "Order and Export".

This is in the "Java Build Path" preferences, right?
So the effect is, that the compiler will not let a project importing A refer to classes from j.jar or k.jar. These checks happen at compile time.

> Project B imports project A.
> The following command executed from within B, which is run through a launch
> configuration:
> System.err.println( System.getProperty( "java.class.path" ) );
> includes j.jar and k.jar from project A.

This, in contrast, happens at runtime. Now for classes in A to correctly be loaded and their code executed they'll likely depend on j.jar and k.jar. So without those jars on the classpath, A would be broken.

Please let me know if I misunderstood anything.
Otherwise I'd say everything works exactly as intended.
Comment 2 Marvin Fröhlich CLA 2012-01-30 05:10:07 EST
Ok, I think, you opened my eyes. Thanks. Should be alright then.
Comment 3 Jay Arthanareeswaran CLA 2012-02-27 00:22:24 EST
*** Bug 372292 has been marked as a duplicate of this bug. ***
Comment 4 Satyam Kandula CLA 2012-03-12 07:00:23 EDT
Verified for 3.8M6