<< Back to previous view

[CLASSPATH-2] Reported classpath should include classpath from parent classloaders, but not from the system classloader Created: 13/Sep/11  Updated: 08/Jan/14  Resolved: 15/Sep/11

Status: Closed
Project: java.classpath
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Hugo Duncan Assignee: Stuart Sierra
Resolution: Completed Votes: 0
Labels: None

Attachments: File recursive-classpath.diff     File recursive-classpath.diff     File recursive-classpath.diff    
Patch: Code


Since a classloader delegates to its parent if it fails to provide a class, the classpath reported by java.classpath should include the classpath of parent classloaders.

At present the reported classpath contains both system and baseloader classpaths, which I believe is incorrect, since the system classloader is not necessarily a parent of the baseloader.

Comment by Justin Balthrop [ 13/Sep/11 8:55 PM ]

If this patch is accepted, it will fix the issue described in http://dev.clojure.org/jira/browse/CLASSPATH-1. Hugo and I talked and his fix is more general than mine, so you can close CLASSPATH-1.

Comment by Stuart Sierra [ 14/Sep/11 9:48 AM ]

Patch does not compile.

Comment by Hugo Duncan [ 14/Sep/11 11:26 AM ]

Oops, I ran the tests, but failed to notice there weren't any...

Updated patch, with a unit test.

Comment by Hugo Duncan [ 14/Sep/11 11:27 AM ]

Updated patch with unit test

Comment by Stuart Sierra [ 15/Sep/11 9:08 AM ]

Patch is good. Not sure about the test. Finding "clojure-.*jar" in the classpath is subject to the build environment. I think all we can reasonably expect is that the classpath is a seq of java.io.Files.

Comment by Hugo Duncan [ 15/Sep/11 9:39 AM ]

The test are normally run from the project's own pom, and even if run from an external project, the classpath will include a clojure jar in the huge majority of cases. I suppose the tests could be guarded with a java property set in the project's pom.

If the tests for the clojure jar are dropped, a test for a non-empty sequence should at least be added.

Comment by Stuart Sierra [ 15/Sep/11 10:52 AM ]

Agreed: the seq should be non-empty and contain Files.

Comment by Hugo Duncan [ 15/Sep/11 11:18 AM ]

Patch with unit test for classpath, testing for non-empty sequence of java.io.File objects as return value.

Comment by Stuart Sierra [ 15/Sep/11 12:53 PM ]

Patch applied. Will release new version soon.

Generated at Wed Oct 22 04:53:55 CDT 2014 using JIRA 4.4#649-r158309.