Commit 5db1f773 authored by mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f's avatar mevenson@1c010e3e-69d0-11dd-93a8-456734b0d56f
Browse files

Intermediary JNEW-RUNTIME-CLASS work: start adding failing tests.

Run the failing tests via

CL-USER> (asdf:load-system :abcl) (asdf:test-system :abcl-test-lisp)

c.f. <> and  <>.

Start editing documentation for JNEW-RUNTIME-CLASS.

Add failing tests for cases that should work, indicating that we have
basic problems with the code at this point.
parent 2d9ac5bf
......@@ -65,6 +65,8 @@
(:file "pathname-tests" :depends-on
(:file "runtime-class")
(:file "package-local-nicknames-tests")))))
(defmethod perform ((o test-op) (c (eql (find-system 'abcl-test-lisp))))
......@@ -28,10 +28,20 @@
be called with the second and first arguments.
Method definitions are lists of the form
(method-name return-type argument-types function &key modifiers annotations)
where method-name is a string, return-type and argument-types are strings or keywords for
primitive types (:void, :int, etc.), and function is a Lisp function of minimum arity
(1+ (length argument-types)); the instance (`this') is passed in as the first argument.
METHOD-NAME is a string
RETURN-TYPE denotes the type of the object returned by the method
ARGUMENT-TYPES is a list of parameters to the method
The types are either strings naming fully qualified java classes or Lisp keywords referring to
primitive types (:void, :int, etc.).
FUNCTION is a Lisp function of minimum arity (1+ (length
argument-types)). The instance (`this') is passed as the first
Field definitions are lists of the form (field-name type &key modifiers annotations)."
(declare (ignorable superclass interfaces constructors methods fields access-flags annotations))
......@@ -73,8 +83,10 @@
(write-class-file class-file stream)
(finish-output stream)
(with-open-file (f (format nil "~A.class" class-name) :direction :output :element-type '(signed-byte 8))
(write-sequence (java::list-from-jarray (sys::%get-output-stream-bytes stream)) f))
(let ((filename (merge-pathnames (format nil "~A.class" class-name))))
(with-open-file (f filename :direction :output :element-type '(signed-byte 8))
(write-sequence (java::list-from-jarray (sys::%get-output-stream-bytes stream)) f))
(format *standard-output* "~&Wrote class file ~A.~%" filename))
(values class-file method-implementation-fields)))
(defun java::make-accessor-name (prefix name)
(in-package :abcl.test.lisp)
;; method with no arguments
(deftest runtime-class.1
:fields `(("name" "java.lang.String"))
:methods `(("getName" "java.lang.String" nil
(lambda (this)
(java:jfield this "name")))))
;; method with primitive type
(deftest runtime-class.2
:fields `(("name" "java.lang.String"))
:methods `(("getName" "java.lang.String" (:int)
(lambda (this)
(java:jfield this "name")))))
;; inheritance of type
(deftest runtime-class.3
:fields `(("name" "java.lang.String")))
:superclass "foo.Actor"
:fields (list '("givenName" "java.lang.String"))))
// Simple constructor test
public class Actor {
String name;
public Actor(String name) { = name;
public String getName() {
return name;
;; constructor
(deftest runtime-class.4
:constructors `(("java.lang.String")
(lambda (name)
(setf (jfield this "name")
:methods `(("getName" "java.lang.String" ("java.lang.String") ;; no-arg methods not working
(lambda (this dummy)
(declare (ignore dummy))
(java:jfield this "name"))))
:fields `(("name" "java.lang.String")))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment