[armedbear-cvs] r13369 - trunk/abcl/src/org/armedbear/lisp
mevenson at common-lisp.net
mevenson at common-lisp.net
Fri Jul 1 14:00:28 UTC 2011
Author: mevenson
Date: Fri Jul 1 07:00:27 2011
New Revision: 13369
Log:
Make JAVA:ADD-TO-CLASSPATH a generic function.
With this change we can customize the mechanism for changing the
classpath. The first planned use is for JSS to use an :after method
to be informed of classpath additions, so we can factor out the ASDF
portion into the ABCL-ASDF extension package.
Add JAVA:GET-CURRENT-CLASSLOADER to access a wrapped instance of the
underlying current JVM classloader being used by ABCL.
Modified:
trunk/abcl/src/org/armedbear/lisp/Autoload.java
trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
trunk/abcl/src/org/armedbear/lisp/Symbol.java
trunk/abcl/src/org/armedbear/lisp/java.lisp
Modified: trunk/abcl/src/org/armedbear/lisp/Autoload.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Autoload.java Wed Jun 29 15:04:37 2011 (r13368)
+++ trunk/abcl/src/org/armedbear/lisp/Autoload.java Fri Jul 1 07:00:27 2011 (r13369)
@@ -532,7 +532,7 @@
autoload(PACKAGE_JAVA, "%load-java-class-from-byte-array", "RuntimeClass");
autoload(PACKAGE_JAVA, "get-default-classloader", "JavaClassLoader");
autoload(PACKAGE_JAVA, "make-classloader", "JavaClassLoader");
- autoload(PACKAGE_JAVA, "add-to-classpath", "JavaClassLoader");
+ autoload(PACKAGE_JAVA, "%add-to-classpath", "JavaClassLoader");
autoload(PACKAGE_JAVA, "dump-classpath", "JavaClassLoader");
autoload(PACKAGE_MOP, "funcallable-instance-function", "StandardGenericFunction", false);
autoload(PACKAGE_MOP, "generic-function-name", "StandardGenericFunction", true);
Modified: trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java Wed Jun 29 15:04:37 2011 (r13368)
+++ trunk/abcl/src/org/armedbear/lisp/JavaClassLoader.java Fri Jul 1 07:00:27 2011 (r13369)
@@ -197,13 +197,26 @@
}
};
- // ### add-to-classpath jar-or-jars &optional (classloader (get-current-classloader))
+ private static final Primitive GET_CURRENT_CLASSLOADER = new pf_get_current_classloader();
+ @DocString(name="get-current-classloader")
+ private static final class pf_get_current_classloader extends Primitive {
+ pf_get_current_classloader() {
+ super("get-current-classloader", PACKAGE_JAVA, true);
+ }
+ @Override
+ public LispObject execute() {
+ return new JavaObject(getCurrentClassLoader());
+ }
+ };
+
+ // ### %add-to-classpath jar-or-jars &optional (classloader (get-current-classloader))
private static final Primitive ADD_TO_CLASSPATH = new pf_add_to_classpath();
private static final class pf_add_to_classpath extends Primitive
{
pf_add_to_classpath()
{
- super("add-to-classpath", PACKAGE_JAVA, true, "jar-or-jars &optional (classloader (get-current-classloader))");
+ super("%add-to-classpath", PACKAGE_JAVA, false,
+ "jar-or-jars &optional (classloader (get-current-classloader))");
}
@Override
Modified: trunk/abcl/src/org/armedbear/lisp/Symbol.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/Symbol.java Wed Jun 29 15:04:37 2011 (r13368)
+++ trunk/abcl/src/org/armedbear/lisp/Symbol.java Fri Jul 1 07:00:27 2011 (r13369)
@@ -2976,7 +2976,7 @@
public static final Symbol JAVA_OBJECT =
PACKAGE_JAVA.addExternalSymbol("JAVA-OBJECT");
public static final Symbol JAVA_CLASS =
- PACKAGE_JAVA.addExternalSymbol("JAVA-CLASS");
+ PACKAGE_JAVA.addExternalSymbol("JAVA-CLASS");
public static final Symbol JCALL =
PACKAGE_JAVA.addExternalSymbol("JCALL");
public static final Symbol JCALL_RAW =
@@ -2991,6 +2991,8 @@
PACKAGE_JAVA.addExternalSymbol("JMETHOD-RETURN-TYPE");
public static final Symbol JRESOLVE_METHOD =
PACKAGE_JAVA.addExternalSymbol("JRESOLVE-METHOD");
+ public static final Symbol ADD_TO_CLASSPATH =
+ PACKAGE_JAVA.addExternalSymbol("ADD-TO-CLASSPATH");
// External symbols in SYSTEM package.
public static final Symbol _ENABLE_AUTOCOMPILE_ =
Modified: trunk/abcl/src/org/armedbear/lisp/java.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/java.lisp Wed Jun 29 15:04:37 2011 (r13368)
+++ trunk/abcl/src/org/armedbear/lisp/java.lisp Fri Jul 1 07:00:27 2011 (r13369)
@@ -43,6 +43,11 @@
(dolist (url urls)
(add-url-to-classpath url)))
+(defgeneric add-to-classpath (jar-or-jars &optional classloader))
+
+(defmethod add-to-classpath (jar-or-jars &optional (classloader (get-current-classloader)))
+ (%add-to-classpath jar-or-jars classloader))
+
(defun jregister-handler (object event handler &key data count)
(%jregister-handler object event handler data count))
More information about the armedbear-cvs
mailing list