java.classpath

Reported classpath should include classpath from parent classloaders, but not from the system classloader

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

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.

  1. recursive-classpath.diff
    15/Sep/11 11:18 AM
    3 kB
    Hugo Duncan
  2. recursive-classpath.diff
    14/Sep/11 11:27 AM
    3 kB
    Hugo Duncan
  3. recursive-classpath.diff
    13/Sep/11 8:35 PM
    2 kB
    Hugo Duncan

Activity

Hide
Justin Balthrop added a comment -

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.

Show
Justin Balthrop added a comment - 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.
Hide
Stuart Sierra added a comment -

Patch does not compile.

Show
Stuart Sierra added a comment - Patch does not compile.
Hide
Hugo Duncan added a comment -

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

Updated patch, with a unit test.

Show
Hugo Duncan added a comment - Oops, I ran the tests, but failed to notice there weren't any... Updated patch, with a unit test.
Hide
Hugo Duncan added a comment -

Updated patch with unit test

Show
Hugo Duncan added a comment - Updated patch with unit test
Hide
Stuart Sierra added a comment -

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.

Show
Stuart Sierra added a comment - 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.
Hide
Hugo Duncan added a comment -

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.

Show
Hugo Duncan added a comment - 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.
Hide
Stuart Sierra added a comment -

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

Show
Stuart Sierra added a comment - Agreed: the seq should be non-empty and contain Files.
Hide
Hugo Duncan added a comment -

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

Show
Hugo Duncan added a comment - Patch with unit test for classpath, testing for non-empty sequence of java.io.File objects as return value.
Hide
Stuart Sierra added a comment -

Patch applied. Will release new version soon.

Show
Stuart Sierra added a comment - Patch applied. Will release new version soon.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: