Skip to content
This repository was archived by the owner on Jan 25, 2019. It is now read-only.

Commit 817fd0f

Browse files
committed
Merge branch 'tobias-java-9-support'
2 parents 91e3012 + 4b7b068 commit 817fd0f

File tree

3 files changed

+26
-14
lines changed

3 files changed

+26
-14
lines changed

boot.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#https://github.com/boot-clj/boot
22
#Sun Nov 15 17:35:18 EST 2015
3-
BOOT_VERSION=2.5.2
3+
BOOT_VERSION=2.7.2
44
BOOT_CLOJURE_VERSION=1.7.0
55
BOOT_CLOJURE_NAME=org.clojure/clojure
66
BOOT_EMIT_TARGET=no

src/Boot.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// vim: et:ts=4:sw=4
22

3+
import boot.bin.ParentClassLoader;
4+
35
import java.io.*;
46
import java.net.*;
57
import java.util.*;
@@ -13,9 +15,10 @@
1315
@SuppressWarnings("unchecked")
1416
public class Boot {
1517

16-
public static final String initialVersion = "2.5.2";
17-
public static final File homedir = new File(System.getProperty("user.home"));
18-
public static final File workdir = new File(System.getProperty("user.dir"));
18+
public static final String initialVersion = "2.7.2";
19+
public static final File homedir = new File(System.getProperty("user.home"));
20+
public static final File workdir = new File(System.getProperty("user.dir"));
21+
public static final ParentClassLoader loader = new ParentClassLoader(Boot.class.getClassLoader());
1922

2023
public static File
2124
mkFile(File parent, String... kids) throws Exception {
@@ -225,13 +228,8 @@ public class Boot {
225228

226229
public static URLClassLoader
227230
loadJar(File jar) throws Exception {
228-
URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();
229-
Class sc = URLClassLoader.class;
230-
Method cm = sc.getDeclaredMethod("addURL", URL.class);
231-
232-
cm.setAccessible(true);
233-
cm.invoke(cl, new Object[]{jar.toURI().toURL()});
234-
return cl; }
231+
loader.addURL(jar.toURI().toURL());
232+
return loader; }
235233

236234
public static void
237235
main(String[] args) throws Exception {
@@ -251,8 +249,9 @@ public class Boot {
251249
System.setProperty("BOOT_VERSION", initialVersion);
252250
System.err.println("Running for the first time, BOOT_VERSION not set: updating to latest."); }
253251

254-
URLClassLoader cl = loadJar(f);
255-
Class c = Class.forName("boot.App", true, cl);
256-
Method m = c.getMethod("main", String[].class);
252+
loadJar(f);
253+
tccl(loader);
254+
Class c = Class.forName("boot.App", true, loader);
255+
Method m = c.getMethod("main", String[].class);
257256

258257
m.invoke(null, new Object[]{a}); }}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package boot.bin;
2+
3+
import java.net.URL;
4+
import java.net.URLClassLoader;
5+
6+
// Exists solely so we have a type to seal to prevent user code from
7+
// altering our top-level CL.
8+
public class ParentClassLoader extends URLClassLoader {
9+
public ParentClassLoader(ClassLoader parent) {
10+
super(new URL[0], parent); }
11+
12+
public void addURL(URL url) {
13+
super.addURL(url); }}

0 commit comments

Comments
 (0)