Help me out!
I made a class called: TestClass
------------------------src/dmiles/TestClass.java--------------------- package dmiles
public class TestClass { static public String StaticField = "fresh"; }
-------------------------------------------------------------------------
Now in the REPL everything works fine.
Armed Bear Common Lisp 0.18.0-dev (built Mon Nov 23 2009 06:46:01 PST) Java 1.6.0_10 Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM Low-level initialization completed in 0.658 seconds. Startup completed in 1.877 seconds. Type ":help" for a list of available commands. CL-USER(1): (defun (setf jfield) (newvalue class-ref-or-field field-or-instance &optional ( instance :noinst) unused-value) (declare (ignorable unused-value)) (if (eq instance :noinst) (jfield class-ref-or-field field-or-instance newvalue) (jfield class-ref-or-field field-or-instance instance newvalue))) (SETF JFIELD) CL-USER(2): (jfield "dmiles.TestClass" "StaticField") "fresh" CL-USER(3): (define-symbol-macro %TESTSYM (jfield "dmiles.TestClass" "StaticField")) %TESTSYM CL-USER(4): CL-USER(4): %TESTSYM "fresh" CL-USER(5): (setf %TESTSYM "flithy") "flithy" CL-USER(6): %TESTSYM "flithy" CL-USER(7): (jfield "dmiles.TestClass" "StaticField") "flithy" CL-USER(8):
---------------------------------------------------------------------------------
Question: locally I added this to the bottem of java.lisp
(defun (setf jfield) (newvalue class-ref-or-field field-or-instance &optional ( instance :noinst) unused-value) (declare (ignorable unused-value)) (if (eq instance :noinst) (jfield class-ref-or-field field-or-instance newvalue) (jfield class-ref-or-field field-or-instance instance newvalue)))
Cleaned and rebuilt the system..
To test it:
Armed Bear Common Lisp 0.18.0-dev (built Mon Nov 23 2009 12:07:35 PST) Java 1.6.0_10 Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM Low-level initialization completed in 0.564 seconds. Startup completed in 1.651 seconds. Type ":help" for a list of available commands. CL-USER(1): (jfield "dmiles.TestClass" "StaticField") "fresh" CL-USER(2): (define-symbol-macro %TESTSYM (jfield "dmiles.TestClass" "StaticField")) %TESTSYM CL-USER(3): %TESTSYM "fresh" CL-USER(4): (setf %TESTSYM "flithy") Debugger invoked on condition of type UNDEFINED-FUNCTION: The function (SETF JFIELD) is undefined. Restarts: 0: TOP-LEVEL Return to top level. [1] CL-USER(5): :bt 0: (SYSTEM:BACKTRACE) 1: (INVOKE-DEBUGGER #<UNDEFINED-FUNCTION {50E26AE7}>) 2: org.armedbear.lisp.Lisp.error(Lisp.java:365) 3: org.armedbear.lisp.SpecialOperators$14.execute(SpecialOperators.java:493) 4: org.armedbear.lisp.Lisp.eval(Lisp.java:461) 5: org.armedbear.lisp.Lisp.evalCall(Lisp.java:501) 6: org.armedbear.lisp.Lisp.eval(Lisp.java:471) 7: org.armedbear.lisp.Lisp.progn(Lisp.java:640) [1] CL-USER(6):
Hw do a add a new (defun (setf ..) .. .) to the library?
armedbear-devel@common-lisp.net