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

Commit

Permalink
Merge branch 'tobias-java-9-support'
Browse files Browse the repository at this point in the history
  • Loading branch information
micha committed Aug 18, 2017
2 parents 91e3012 + 4b7b068 commit 817fd0f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 14 deletions.
2 changes: 1 addition & 1 deletion boot.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#https://github.com/boot-clj/boot
#Sun Nov 15 17:35:18 EST 2015
BOOT_VERSION=2.5.2
BOOT_VERSION=2.7.2
BOOT_CLOJURE_VERSION=1.7.0
BOOT_CLOJURE_NAME=org.clojure/clojure
BOOT_EMIT_TARGET=no
25 changes: 12 additions & 13 deletions src/Boot.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// vim: et:ts=4:sw=4

import boot.bin.ParentClassLoader;

import java.io.*;
import java.net.*;
import java.util.*;
Expand All @@ -13,9 +15,10 @@
@SuppressWarnings("unchecked")
public class Boot {

public static final String initialVersion = "2.5.2";
public static final File homedir = new File(System.getProperty("user.home"));
public static final File workdir = new File(System.getProperty("user.dir"));
public static final String initialVersion = "2.7.2";
public static final File homedir = new File(System.getProperty("user.home"));
public static final File workdir = new File(System.getProperty("user.dir"));
public static final ParentClassLoader loader = new ParentClassLoader(Boot.class.getClassLoader());

public static File
mkFile(File parent, String... kids) throws Exception {
Expand Down Expand Up @@ -225,13 +228,8 @@ public class Boot {

public static URLClassLoader
loadJar(File jar) throws Exception {
URLClassLoader cl = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class sc = URLClassLoader.class;
Method cm = sc.getDeclaredMethod("addURL", URL.class);

cm.setAccessible(true);
cm.invoke(cl, new Object[]{jar.toURI().toURL()});
return cl; }
loader.addURL(jar.toURI().toURL());
return loader; }

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

URLClassLoader cl = loadJar(f);
Class c = Class.forName("boot.App", true, cl);
Method m = c.getMethod("main", String[].class);
loadJar(f);
tccl(loader);
Class c = Class.forName("boot.App", true, loader);
Method m = c.getMethod("main", String[].class);

m.invoke(null, new Object[]{a}); }}
13 changes: 13 additions & 0 deletions src/boot/bin/ParentClassLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package boot.bin;

import java.net.URL;
import java.net.URLClassLoader;

// Exists solely so we have a type to seal to prevent user code from
// altering our top-level CL.
public class ParentClassLoader extends URLClassLoader {
public ParentClassLoader(ClassLoader parent) {
super(new URL[0], parent); }

public void addURL(URL url) {
super.addURL(url); }}

0 comments on commit 817fd0f

Please sign in to comment.