[armedbear-devel] patch for runtime-class.lisp
Milos Negovanovic
milos.negovanovic at gmail.com
Mon Jan 28 19:30:35 UTC 2013
Hi all,
As mentioned on #abcl on freenode, I needed the following patch to make
my simple jetty example work.
Patch is attached. Example for which I needed this is at:
http://paste.lisp.org/display/134966
Regards
--
Milos Negovanovic
milos.negovanovic at gmail.com
-------------- next part --------------
Index: src/org/armedbear/lisp/MemoryClassLoader.java
===================================================================
--- src/org/armedbear/lisp/MemoryClassLoader.java (revision 14361)
+++ src/org/armedbear/lisp/MemoryClassLoader.java (working copy)
@@ -52,6 +52,11 @@
this.internalNamePrefix = internalNamePrefix;
}
+ public MemoryClassLoader(JavaClassLoader parent) {
+ super(parent);
+ this.internalNamePrefix = "";
+ }
+
@Override
protected Class<?> loadClass(String name, boolean resolve)
throws ClassNotFoundException {
Index: src/org/armedbear/lisp/JavaClassLoader.java
===================================================================
--- src/org/armedbear/lisp/JavaClassLoader.java (revision 14361)
+++ src/org/armedbear/lisp/JavaClassLoader.java (working copy)
@@ -123,6 +123,10 @@
public JavaClassLoader(ClassLoader parent) {
super(new URL[] {}, parent);
}
+
+ public JavaClassLoader(JavaClassLoader parent) {
+ super(new URL[] {}, (ClassLoader)parent);
+ }
public JavaClassLoader(URL[] classpath, ClassLoader parent) {
super(classpath, parent);
Index: src/org/armedbear/lisp/runtime-class.lisp
===================================================================
--- src/org/armedbear/lisp/runtime-class.lisp (revision 14361)
+++ src/org/armedbear/lisp/runtime-class.lisp (working copy)
@@ -35,9 +35,10 @@
Field definitions are lists of the form (field-name type &key modifiers annotations)."
(declare (ignorable superclass interfaces constructors methods fields access-flags annotations))
- (let ((stream (sys::%make-byte-array-output-stream))
- ;;TODO provide constructor in MemoryClassLoader
- (memory-class-loader (java:jnew "org.armedbear.lisp.MemoryClassLoader" "")))
+ (let* ((stream (sys::%make-byte-array-output-stream))
+ ;;TODO provide constructor in MemoryClassLoader
+ (current-class-loader (java:get-current-classloader))
+ (memory-class-loader (java:jnew "org.armedbear.lisp.MemoryClassLoader" current-class-loader)))
(multiple-value-bind (class-file method-implementation-fields)
(apply #'java::%jnew-runtime-class class-name stream args)
(sys::put-memory-function memory-class-loader
@@ -297,4 +298,4 @@
(list "bar" :int '("java.lang.Object")
(lambda (this that) (print (list this that)) 23))))
-(provide "RUNTIME-CLASS")
\ No newline at end of file
+(provide "RUNTIME-CLASS")
More information about the armedbear-devel
mailing list