abcl
abcl copied to clipboard
jnew-runtime-class doesn't work right after starting a repl
Example:
Doesn't work:
$ abcl
CL-USER(1): (jnew-runtime-class "org.example.Foo")
#<THREAD "interpreter" {1A5BE58F}>: Debugger invoked on condition of type JAVA-EXCEPTION
Java exception: #<java.lang.NoSuchMethodException java.lang.NoSuchMethodException:.... {5EC57AD0}>.
Can be worked around by first calling something in the java
package:
$ abcl
CL-USER(1): (print-object (jclass "java.lang.Object") t)
#<java.lang.Class class java.lang.Object {5DE63519}>
"#<java.lang.Class class java.lang.Object {5DE63519}>"
CL-USER(2): (jnew-runtime-class "org.example.Foo")
#<java.lang.Class class org.example.Foo {5144A428}>
Expected behavior:
The initialization done by the workaround could be done automatically, so that jnew-runtime-class
would work right after starting ABCL.
Fixed with https://github.com/armedbear/abcl/pull/471
@easye I still have this after that merge - it's a separate problem from the print-object
stuff. I think this problem has something to do with initialization of the Lisp runtime, maybe the Java interop code is lazily loaded somehow.
Alright. Re-opening.
Alright. Re-opening.
Thank you
Alright. Re-opening.
Thank you
Working with abcl-1.9.2:
CL-USER(8): (jnew-runtime-class "org.example.Foo")
#<java class org.example.Foo>
CL-USER(9): (describe *)
#<java.lang.Class class org.example.Foo {59FA3435}> is an object of type JAVA-OBJECT.
The wrapped Java object is an instance of java.lang.Class:
"class org.example.Foo"
CL-USER(10): (lisp-implementation-version)
"${abcl.version}-git-c3feba71"
"OpenJDK_64-Bit_Server_VM-MacPorts-17.0.8+7"
"aarch64-Mac_OS_X-13.5.1"
CL-USER(11):