<< Back to previous view

[CLJ-673] RT.load doesn't work when called by code that is on the bootstrap classpath Created: 08/Nov/10  Updated: 23/Sep/11  Resolved: 23/Sep/11

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: None
Fix Version/s: Release 1.3

Type: Defect Priority: Minor
Reporter: Phil Hagelberg Assignee: Unassigned
Resolution: Completed Votes: 1
Labels: None

Attachments: File fix-clj-637.diff    
Patch: Code
Approval: Screened


RT.baseLoader assumes Compiler.getClass.getClassLoader will return a sane value. If Clojure is placed on the bootclasspath, it will return null.

Relying on baseLoader less may be possible; it looks like the ClassLoader/getSystemResource static method may get us the access we need to the bootstrap classloader, which would solve the problem I first noticed with using RT.load with the bootstrap classloader. However, there may be other issues beyond this.

More details at http://groups.google.com/group/clojure/browse_thread/thread/16c694573bd29552

I plan on investigating this further, but I've created this ticket to explain what I've discovered so far for posterity, etc.

Note that placing Clojure on the bootclasspath cuts its startup time in half; it's a measure that Charles Nutter of the JRuby project recommends.

Comment by Kevin Downey [ 29/Jun/11 10:04 PM ]

'lo as if from nowhere a patch!

Comment by Aaron Bedra [ 06/Aug/11 10:17 AM ]

Patch looks reasonable, but I am waiting for a response from Phil to see if this resolves his issue.

Comment by Phil Hagelberg [ 11/Aug/11 7:56 PM ]

I just tested it again with the latest Clojure from git and it works fine. Here's an easy test that breaks without the fix: java -Xbootclasspath/a:clojure-1.3.0-master-SNAPSHOT.jar clojure.main -e "(require 'clojure.pprint)"

Generated at Tue Jan 16 13:22:28 CST 2018 using JIRA 4.4#649-r158309.